ratko995 :
The main reason for buying an iMac is for work (web development). Working for several hours on my current computer burns my eyes because of the bad display. I know that 5k iMac is overkill for a normal developer but I am willing to invest in it for working comfortability.
People forget that Apple doesn't actually make hardware, they just repackage other companies' hardware. The 5k panel in the iMac is actually an LG LM270QQ1. The Dell Up2715K uses the same panel and is available for $1993 from Provantage if you just want to attach the nice monitor to your current computer (you may need to upgrade video cards to one capable of dual displayport to drive it at 60 Hz). If you get the screen mated to the iMac, it will always be mated to that iMac. If you buy an external monitor, you can attach it to the new computer when you upgrade. I find I tend to use monitors for about 10 years, while I upgrade computers every 3 years.
Stick with monitors using IPS (LG), PLS (Samsung), or AHVA (AUO) panels if staring at the screen hurts your eyes. Avoid the TN panels. Turn down the brightness to match the ambient room lighting. It may seem dim at first, but after a few hours it'll be a lot more comfortable. You want the monitor to simulate looking at a well-lit printed piece of paper, not staring at a neon sign.
Would there be a difference between 2k and 5k IPS display when working for several hours?
That really depends on your age, the distance you'll be sitting from the monitor, and font size. The younger you are, the closer you sit to the screen, and the smaller your fonts, the more likely you'll see a noticeable improvement. That said, even my 45 year old eyes can easily see the pixels on a 24" 1080p monitor, so 27" 2k wouldn't be much of an improvement. I was planning on a 4k monitor as my next upgrade. 5k seems like overkill, especially for the price (nearly 3x a 4k IPS monitor).
But really, eyestrain is usually caused by the monitor being set too bright for the ambient lighting. Turn it down so a white screen is only slightly brighter than a white piece of paper.