Recently my S8+ has been overheating and taking a huge amount of timw to charge 6hrs plus at times.
I took my device to my local samsung centre who offered some advice on how to reduce the load on the battery or processor. But this advice has not since worked. This is a very frustrating issue to say the least and really should not be happening on such high end flag ship devices from samsung!!
My advice is to put the phone in Safe Mode which disables your downloaded apps and leaves the stock apps running.
If the issue stops then it's most likely to be a rogue app.
If the issue still exists then create back ups and factory reset.
If no resolution then insist the Samsung Service Location carries out a diagnostic under the Manufacturing Warranty
Current Phone >Samsung Z Fold³ 5G.
Previous Phone > Note 20 Ultra 5G SM-N9860.