To add to den.thed's wisdom on the subject, actions you have done so far without helping can suggest a positioning issue that is causing overheating. All iMacs have two critical areas that CANNOT be blocked or allowed to get dirty.
Cool air intake vents are one the bottom edge of the case:
1) They WILL get dirty and should be checked for build-up of dust bunnies and other workspace dirt at least twice a year, more if you live in a dusty environment. Do NOT blow it off with "canned air;" that can drive crud deeper into the computer where it is even harder to evict. I place a soft towel on the kitchen table, then set the iMac on it screen-down with vents slightly hanging over the edge. Then I use a static-free pastry brush to flick the dirt toward a vacuum cleaner nozzle held about an inch away. You may need an assistant to make certain the iMac remains safely stable on the table.
2) Even if very clean, the intakes cannot do their job if you stack stuff under the computer case or do anything that reduces the roughly 2.8 inches between the vent and the work surface. Consider this "sacred space."
The exhaust vent is hidden behind the stand:
It is not as critical as the intakes but, in helping another here with an iMac overheating a couple of years ago, I found a position in which the exhaust was almost fully occluded and caused documented high temps. That happens when you tip the display fulling forward.
The poster I helped had mounted his iMac 5K above the monitor of another computer. Tipping the screen down to avoid glare blocked the exhaust and the temps rose quickly. I was able to duplicate that with my iMac.