The first thing I'd do is check the thermal paste and dust. A lot of the times when this happens, the cause is related to dust buildup from the system being a couple of years old. In some cases, the problem isn't dust but is related to the thermal paste being dried out.
The first thing to do that is likely to fix the problem is to repaste the CPU and GPU. If you have the dGPU model of this machine, you will also need thermal pads as thermal paste is not sufficient for many laptops with dedicated graphics due to there being a gap.
Here is what you will need:
Thermal pads (dGPU only)
Thermal paste (Artic MX-4)