My son's 2015 5k iMac used to overheat a lot, usually when watching Netflix and then bringing up any sort of screen overlay. The GPU would shoot up to 110 degrees and machine would just turn off. It was generally running hot, with the fan always at 80% or higher.
No amount of sucking or blowing at the vents on the case would really fix this, so a few months back I bit the bullet, bought a screen sticky tape kit and opened the iMac for a good clean and re-grease. The original thermal compound was all dry and brittle, I replaced it with Arctic Ceramique 2. Also cleaned all vents, fins and the fan. The machine runs very cool now, the fan is inaudible most of the time. No more shutdowns due to overheating.
It's a pity that Apple still uses cheap thermal compound (I had to regrease all of my MacBook Pros after 3 years or so) and makes this sort of cleaning and service difficult. I liked it a lot better when the iMac screens were attached with magnets...