iMac G5s in general had all sorts of issues besides just bad LCD Panels. The capacitors on both the power supplies and Logic Boards tend to swell & leak which can cause these & other issues. Plus on such an old system, the heatsink may have become clogged with dust as well as the thermal paste on the GPU having dried out. It is easy to remove the back cover of the iMac G5 which can allow you to clean the dust from the heatsink fins (best to use compressed air to blow the dust from the top of the heatsink downwards/backwards towards the fan as the dust collects between the fan and the heatsink). You can also take a look at the capacitors on the Logic Board to see if the tops of any of them are swollen or even leaking brownish electrolyte.
See this page for some pictures showing both leaking & swollen capacitors (the tall cylindrical items). I am not suggesting this company's services as I know nothing about them except they had some very good pictures. FYI, there are two swollen capacitors shown in addition to the five that are easily seen leaking the brown electrolyte.
https://elitemactechs.com/blog/swollen-capacitors-imac-g5/