If you value the 27" screen size, and need performance, you should really consider getting a studio display + mac mini.
Might be slightly more expensive but if you want to upgrade 5 years from now, you'll be glad you don't have to buy the same display yet again.
Regarding your performance needs. I don't know what you do, but first of all your old mac doesn't have 72GB RAM.
It has 64GB RAM and 8GB VRAM. So basically CPU can use 64 and GPU can use 8. What GPU uses will be duplicated in the RAM as well.
A Mac mini with 32GB unified memory, is like having 32GB RAM the CPU can use AND 32 VRAM the GPU can use, no duplication needed.
While I don't have iMac experience, I can tell you that I went from a 2019 16" mbp with 64GB RAM and 8GB VRAM to a 32GB UM M1 Max and I was blown away. Then I "downgraded" further to M5 with 24GB UM and the performance was still better for CPU bound tasks.
If your budget allows and you want to be safe get a M4 Pro Mac Mini with 48GB RAM and I can guarantee you that it will not be a downgrade at all, whatever you use your mac for.