Structure-dynamics relationships in perovskite oxyhydrides and alkali silanides