On Earth, heat travels by conduction , convection and radiation . In space conduction and convection are almost entirely nonexistent.
Radiation is the primary way that heat travels in space.
That means that heat is not spread out through the medium it travels through as on Earth. On Earth on a sunny day, the heat radiating from the Sun warms the molecules of the atmosphere, and they warm other molecules and they warm others in turn. That conduction is what keeps the Earth warm at night when we aren't receiving direct Sun rays. It also means that even when we are standing in shadow, the air around us has some warmth. On Earth, heat also travels in large density-driven convection loops that spread out the warmth.