There's Luna Display. It doesn't turn the iMac into a real hardware monitor – it appears to be more of a software (virtual screen) solution, with a hardware component that you have to plug into the primary computer.
I think you MIGHT be able to run at 5K with a resolution of 30 Hz or 45 Hz if
- You have the USB-C version of Luna Display (which costs $120)
- You have Mini with a USB-C port
- You plug the Luna Display directly into one of the Mini's USB-C (Thunderbolt) ports – tying up one of the valuable USB-C (Thunderbolt) ports)
- You make an Ethernet-to-Ethernet connection or Thunderbolt-to-Thunderbolt connection (for which you would need a Thunderbolt 3-to-2 adapter and a Thunderbolt 2 cable) between the Macs. (I'm not sure if connecting over WiFi would be a good idea for 5K.)
- You're not planning to display "gaming or other high-motion content."
Note that I may have misread some of the help and system requirements articles on the site. I'd recommend contacting the vendor to see that I haven't read things backwards. Also finding reviews by people (other than the vendor) who have used the thing with 5K iMacs to see how well they think it works.
https://astropad.com/product/lunadisplay/
https://shop.astropad.com/collections/shop-astropad/products/luna-display?variant=12202370793531
(See the 'Before you buy' link on the second page for links to System requirements)