Did you use the iPhone while it was getting warmer than usual?
Did you get a temperature warning?
...
If your device gets too warm
iOS and iPadOS devices have built-in protections to prevent overheating. If the interior temperature of your device exceeds the normal operating range, your device will protect its internal components by attempting to regulate its temperature.
Avoid these conditions and activities because they might change the performance of your device:
- Leaving your device in a car on a hot day.
- Leaving your device in direct sunlight for an extended period of time.
- Using certain features in hot conditions or direct sunlight for an extended period of time, such as GPS tracking or navigation in a car, playing a graphics-intensive game, or using augmented-reality apps.
If the interior temperature of your device exceeds the normal operating range, you might notice these changes:
- Charging, including wireless charging, slows or stops.
- The display dims or goes black.
- Cellular radios enter a low-power state. The signal might weaken during this time.
- The camera flash is temporarily disabled.
- Performance slows with graphics-intensive or augmented-reality apps or features.
Additionally, if you're navigating, your device might show this alert and turn off the display: "Temperature: iPhone needs to cool down." Navigation still provides audible turn-by-turn directions. When approaching a turn, the display will illuminate to guide you through the turn.
...
copied from: If your iPhone or iPad gets too hot or too cold - Apple Support
You can visit an Authorized Apple Service Provider or Apple Store next to your place, and ask them to diagnose your device, in case this is hardware related.
Use this link to find one:
Apple - Find Locations