Like the message says, for some reason the phone is getting too hot and that's why the flash is getting temporarily disabled.
Are you playing graphic intensive games or watching videos before that? There has to be a reason that the phone is getting too hot.
If this happens during normal use, and to make sure that this is not software related, restore the phone to factory settings, without using any backup data. Then test the phone if it is getting hot again. If it does not, restore from the latest backup. If the problem comes back, the backup contained damaged data, causing this issue.
If setting it back to factory settings does not change that, the device has to be checked, in that case the problem could be hardware related.
Use iTunes to restore your iOS device to factory settings - Apple Support
If the device exceeds a certain temperature threshold, it will present a temperature warning screen similar to this:

To resume use of your device as quickly as possible, turn it off, move it to a cooler environment, and allow it to cool down.
copied from Keeping iPhone, iPad, and iPod touch within acceptable operating temperatures - Apple Support