The ozone layer in the Earth's stratosphere absorbs and blocks most of the harmful ultraviolet (UV) rays from the Sun, particularly UV-B rays, which can cause skin cancer and other health issues. X-rays and gamma rays are not significantly blocked by the ozone layer.