The hotter the heat source, the further away it can warm.
The sun is very hot so it impact is felt even further away than the Earth.
The real reason is that "thermal radiation", in other words, HEAT, can travel through the vacuum of space just like light and ALL electromagnetic radiation, from gamma rays, x-rays, radio waves and ALL visible and invisible electromagnetic radiation.