Some iMacs support a feature called "Target Display Mode". Looks like Apple no longer supports it, but it is worth taking a peek to see if you can use it. https://apple.stackexchange.com/questions/389348/what-are-th...
There's also some screen extender software, but you absolutely want a wired connection or it'll be painful.