Target Display Mode went away when the first 5K Retina iMac – the one that you have – came out. Apple has also added restrictions such that no current Mac supports using any iMac (even an older one) as a Target Display.
There is a third-party workaround product called Luna Display that might let you use that iMac as a second display. But even if you plugged the Luna Display device into a Mac mini, then ran a separate USB cable from the Mac mini to the iMac to help carry video data, it wouldn't be the same as a real hardware video connection. An article on the Astropad site itself says that Luna Display has limitations and is not recommended for high-motion content such as gaming or video editing.
So you're going to need to get a real display for the Mac mini.
In terms of 27" 5K screens, the closest thing to your iMac screen would be the 27" Apple Studio Display ($1600+). For a long time, it and the 27" LG 5K UltraFine display were the only two 27" 5K displays on the market. Now there are several others that have come out or about to, from Samsung, Asus, and ViewSonic.
27" 4K screens are much easier to find, and generally cheaper. You can find some budget 27" 4K screens with IPS panels and 100% or near-100% coverage of sRGB for as little as $300 - $400.