Hi,
It is not a bug, it's a feature to avoid iPhone motherboard from getting damaged.
Post iOS 16 update, this pop up started appearing only when phone detects little bit of heat which is not hot to touch though.
To continue charging either reboot your phone or just wait for a while and automatically the phone will continue to charge.
Even I had the same issue(which I thought it was), but when I googled about it, I found out it is completely normal.
Either ignore the message if not in hurry to charge and go out or reboot the phone to charge your phone at that instance.