Please provide more details on the issue that you are experiencing. What are you doing when this occurs? What apps are running? What version of software is on your phone? etc.
Can you confirm what device you are using?
Have you tried testing the device in safe mode to see if the device continues to overheat while charging?
Let's try putting the device in Safe mode to determine if there are external factors that cause this symptom. This step will temporarily disable all your third-party apps, but none of your personal data will be deleted. Your customization settings (Wallpaper, Themes, et cetera) will be reset to default once you exit this mode.
Please follow the steps below:
1. Turn the device off.
2. Press and hold the Power key past the model name screen.
3. When "SAMSUNG" appears on the screen, release the Power key.
4. Immediately after releasing the Power key, press and hold the Volume down key.
5. Continue to hold the Volume down key until the device finishes restarting.
6. Safe mode will display in the bottom left corner of the screen.
7. Release the Volume down key when you see Safe Mode.
8. To exit Safe Mode, restart your device.
Thank you for confirming this.
Have you confirmed your phone is currently up to date?
Let's try wiping the system cache partition on your device to see if that helps any.
If you are still experiencing the same symptoms after wiping the system cache partition and in safe mode, I recommend backing up the device and perform a factory reset. I know this may not be the ideal step to take, but this will reset the device to its factory settings.