I do a lot of editing RAW files (e.g., Lightroom, Adobe Camera Raw, D850).
I had a 2014 iMac and the base (discrete) GPU was more than enough. More important is an SSD and a decent CPU, and a moderate amount of RAM (like 32GB).
Watch out: the earlier 5k iMacs (like 2014, 2015) often suffer from image retention and/or pink edges on the screen. Carefully check this out before buying. Sucks to have screen issues when doing image editing.