If a planet is too close to its sun, it’s too hot for life as we know it, too far away and everything is frozen, but around each star there’s a Goldilocks Zone where there is the potential for water on a planet’s surface. As we know water is essential for life.
Earth is known as a Goldilocks planet as it has a not too hot and not too cold climate which allows water to exist in all three states ( solid, liquid and gas ). This makes it perfect for life.
However, there are more factors at work than how close a planet is to its closest star. The hottest planet in our solar system is actually Venus as its thick atmosphere traps heat. Mercury which is closest to the sun is still extremely hot but rotates very slowly ( one earth day is 59 days on Mercury ) so the side of the planet facing away from the sun doesn’t get much heat and as Mercury doesn’t have much atmosphere to hold the heat, temperatures can reach as low as -300 degrees Fahrenheit on the dark side.
For scientists searching for life in other solar systems, the Goldilocks Zone ( where rather like the littlest bears porridge it’s not too hot and not too cold ) around stars is a good place to start, but is be no means a guarantee of finding life.