You might have noticed that your iPhone's screen dims at random from time to time, but there are a few reasons as to why this is and what causes this to happen, but you might not have known the real reason for it and its purpose.
The most obvious reason as to why your iPhone's screen might dim at random is due to your iPhone's Ambient Light Sensor feature being turned on. So even if your screen's brightness is turned up to maximum, your Ambient Light Sensor will dim your brightness down instantly if you are in a darkened environment, and then return to a higher brightness when you are in a brightened environment.
But what happens if you notice your iPhone's screen dimming when you have your Ambient Light Sensor turned off in the settings menu and you're screen still dims from time to time? Well, this is a feature in all iPhone's to regulate heat. If you're iPhone has been subjected to very warm temperatures, it will go through a number of protocols and one noticeable one is dimming the screen to reduce the required power from the battery and help with cooling.
Take a look at the video below by the YouTube channel: Apple Explained on Why The iPhone Randomly Dims