Keep Your iPhone Out of the Sun, and Don’t Put It in the Freezer
Keep your iPhone in the shade, and minimize usage when you’re under the sun (at beaches or swimming pools, for example).
If your iPhone does shut down and show a temperature warning, turn it off immediately to help it cool down as fast as possible.
But never put your iPhone in the fridge or freezer. It might seem like a good idea at the time, but cold temperatures can also damage your battery and rapid temperature swings will likely make it worse.