My phone keeps overheating and shutting off
So my galaxy s8 has started having this problem for a while maybe started 8 months ago. But if I have my brightness up too high and use it too long or play a graphically intensive game. The side with the power button will get extremely hot. This also happens if i’m in a hot environment or humid one and I even use the phone for too long. Then eventually it will shut off and if I turn it back on it will just shut back off so I have to wait maybe 15 minutes to turn it back on in order to use it. Other problems is it says its fast charging then switch to cable charging but charge at the same speed. Ive had the phone for two years now but I really don’t want to get a new one, so what should I do?