Water temperature
Cold washes almost everything, and about ninety percent of a wash cycle’s energy goes into heating water. Hot is not a better clean, it is a different job: sanitising, and heavy grease.
Cold, for most of it
Twenty to thirty degrees Celsius suits modern detergents, protects colour and elastane, and shrinks nothing. If clothes come out of a cold wash unclean, the fault is usually dose, load size or cycle length rather than temperature.
Hot, when it is a hygiene question
Sixty degrees and above is what reliably reduces bacteria and dust mites: bedding during illness, towels, cloth nappies, anything belonging to someone immunocompromised. Below that you are cleaning, not sanitising, and it is worth being clear which one you need.
The middle ground
Forty degrees is the compromise for heavy grease and oily cooking clothes, where you want the fats mobile without cooking the enzymes.
Rinse temperature does not matter
Rinse in cold regardless. A warm rinse costs energy and does nothing that the wash has not already done.