Is the iMac free to breathe? The cooling air intakes are on the bottom edge of the case, and the hot-air exhaust is just above the RAM door on the back:

If either are blocked, be it furniture, dust, or workstation arrangement, you will get overheating. This image was posted here by a user who could not understand why his iMac was running hot:

Now we know. One must respect the ~3 inches of clearance between the bottom of the iMac and the work surface. Those vent slt gather dust. I check mine about three times a year.
I worked another overheating case here where the cause was initially unclear until the poster added that the iMac was mounted above his head and tipped fully down. When I tipped my 2017 iMac 5K (4.2 i7 processor) fully forward , I saw that the top of the stand was crowding the exhaust vent. Yes, the temps spiked in under a minute. I would not have beleived it before I duplicated the other poster's positioning with my computer.
Among suspects, your i7 is pretty far down the list. I've now owned two i7 iMacs and both have been excellent.
On the software side, useless anti-virus and so-called "cleaning" apps will run up temps. The Chrome browser tent to run hot as well.
If you are sure that your venting and workstation layout are not hampering air movement, then we need something else. If you want a data-driven evaluation in this setting where we can neither see nor touch your computer, please post an EtreCheck report. We can quickly and within the limitations of these forums help you determine what issues are at play without our playing a protracted game of "20 Questions" with you that could go on for days.
EtreCheck Pro is available here:
https://etrecheck.com/index
The free version will do nicely for this purpose, although the app is worthy of our financial support.
We can see hard data about drive performance, software issues and interferences, and RAM usage. Etrecheck is the development of a long-serving and trusted ASC contributor. It is a reporting app, not a "fix-it” app, expressly for displaying information in these forums to help us help you remotely. It will not reveal any personal or secure information.
Please see this excellent user tip on how to post long text reports like EtreCheck's into a forum response:
How to use the Add Text Feature When Post… - Apple Community