Why wont your car start after driving it but will start after letting it sit for a while?

The temperature sensor needs

Replacing.