The light and warmth from the Sun travels through space to Earth, and it passes through our atmosphere. (The “atmosphere” is what we call the atmosphere around our planet.)
But the atmosphere is not ideal for absorbing heat from the Sun. The heat just slides straight into it. (For adults read: that’s because air at higher altitudes decreases as gas particles grow and lose energy.)
Eventually, the heat from the Sun strikes the ground and the soil softens it. This is especially true of forests and the sea, which is ideal for absorbing heat. Some places, such as snow camps, have more opportunities to reflect radiation – which means they return to the Sun instead of being sunburned.
The higher you go, the farther away you are from the heater that keeps us all warm – the ground absorbs the heat from the Sun. It can be very cold in the mountains and people can die within minutes without special protection. That is because the air at the top is very bad at just “catching” the rays from the Sun, and the heat passes directly into its downward spiral.
And as far as space, there are many rays from the Sun, and astronauts wear special suits to protect themselves from them. But there is also no air in the space, which means there is nothing at all to “catch” the warmth of the Sun and make the surrounding heat feel warm.
So if you were unlucky enough to be caught in space without a suit, you would freeze to death before the sun’s rays hit you.