Greetings amhb8,
If your iMac is compatible, you can learn how to use it as an external display here:
Use your iMac as a display with target display mode - Apple Support
"How to use target display mode
- Make sure that your iMac is started up and meets the system requirements above.
- Make sure that the other Mac is started up and logged in to a macOS user account.
- Connect the two computers using the appropriate Mini DisplayPort or Thunderbolt cable.
- You can use more than one iMac as a display, if each iMac is using a Thunderbolt cable to connect directly to a Thunderbolt port on the other Mac (not the other iMac).
- Press Command-F2 on the keyboard of the iMac. You should now see the desktop of the other Mac.
- To exit target display mode, press Command-F2 again. Or disconnect the cable, or restart either Mac.
Apps that were open on your iMac when entering target display mode remain open in target display mode. For example, if you begin playing music on your iMac and then enter target display mode, the music doesn't pause on your iMac.
The other Mac can't use the iMac computer's built-in camera or ports. To use external devices with your other Mac, connect them directly to the other Mac, not to your iMac."
Take care.