That is indeed a popular topic -- but no harm is done by asking again. There are ways, and than there are ways; it just depends upon your use case.
One user in these forums does a good job of laying out what you can do with
screen-sharing, but keep in mind that you won't get full hardware acceleration out of that. That means it'll work fine for most productivity purposes, but it will probably falter on high speed full screen graphics, such as what you might get with video games or 4K movies. (I believe the video demos that he posted are at 1440p -- but probably best to verify with him, as I believe he had additional testing that he was planning, last time I chatted with him.)
Some older iMacs had a feature called "Target Display Mode" which incorporated the type of use you're describing directly at the hardware level, but unfortunately that feature was discontinued entirely the year before your Mac was introduced. If memory serves, the reason was it simply wasn't practical to use a 5K 27" iMac as a screen by way of Target Display Mode, because the connectivity available on Macs at the time would have required the use of both Thunderbolt ports to carry a full 5K signal. I'm not sure how a 4K iMac would have faired... but those were introduced the same year, so that question is probably moot.
There are also people who have gone down the hardware mod route, basically gutting an iMac to convert it into an actual-no-kidding monitor, but that's usually done with the 27" iMacs, as 4K standalone screens similar to your iMac are quite a bit easier to find than 5K standalone screens. One such modder is
Luke Miani; I think his YouTube video makes for interesting viewing, even if you're not up to the task of trying to follow in his footsteps.
The other obvious alternative is to just sell that iMac and use the proceeds to buy yourself a 4K display, if you have that option. I have a
27" 4K Dell display sitting next to my 5K iMac with which I'm quite satisfied; you could probably also find something similar in the 21" range if that's your preference.