When an electromagnetic wave meets a substance, it can be absorbed, transmitted, reflected or refracted. Often more than one of these happens at once. Which effect is strongest depends on the substance and on the wavelength of the wave.
Glass is a good example. It transmits visible light, so we can see through a window, but ordinary glass absorbs much of the ultraviolet radiation from the Sun. Metals reflect radio waves and microwaves, so a metal dish can be used to collect satellite signals. Water absorbs microwaves, so the water in food is heated in a microwave oven. Soft tissue transmits most X-rays but bone absorbs them, which is how an X-ray image is formed.
Refraction is a change in direction when a wave passes from one substance into another. It can also vary with wavelength, so different colours of light are refracted by different amounts.