Is it dangerous to be near a pokemon using Perish Song? Assuming you’re not the intended target, of course.

Only if you’re a pokémon (or partly one). For pokémon, yes, you will need to ensure the safety of everyone on the battlefield. If a wild pokémon uses it, have your poké ball on hand, as well as perhaps an empty one if the user would be put in danger by fainting in the open.

For humans, however, it’s just deeply annoying. Think nails on a chalkboard both during initial use and briefly when the move is supposed to take effect.