I have a 32" 4k on linux and love it. The dpi is high enough for very sharp fonts. Imho 40" is too large for coding. The fonts are not ‘ultra sharp’ / ‘retina’ anymore at that size. But ymmv.
Fire up a linux stick on that 5k iMac and compare native resolution to 2560x1440, that is basically the difference. If you can live with the lower pixel pitch, you can get a lot more screen for the money. Otherwise you might just go with one of the 27" 5k screens because you really don’t want to come home and think “my monitor sucks” every single day.
I am looking for a monitor for sub 30k INR. Monitors are quite expensive in india. I even thought of importing crossover monitors from korea, again there is a huge uncertainty of customs import charges.
It seems like 24inch 4k would make much better sense than a 29 inch 1080p