The potential danger of an electromagnetic wave increases as its frequency increases. A higher frequency means each part of the wave carries more energy, so it can do more damage when it is absorbed.
In order of increasing frequency the spectrum runs radio waves, microwaves, infrared, visible light, ultraviolet, X-rays and gamma rays. Radio waves have the lowest frequency and are the least dangerous. Gamma rays have the highest frequency and are the most dangerous.
Waves at the low-frequency end mostly make the substance that absorbs them warmer. Ultraviolet, X-rays and gamma rays can damage or mutate cells, which can lead to cancer. The danger also depends on how intense the radiation is and how long a person is exposed to it.