Back in 2009, Apple introduced a feature called Target Display Mode that essentially allowed an iMac to be used by another Mac as an external display. The feature eventually retired in 2014, but it seems that with macOS Monterey, Apple might have revived it to a certain extent in a different form.
This is because with macOS Monterey, Apple will once again allow users to use Macs as an external display for another Mac. However, this will depend on the Mac model as only eligible models can be used in this way, but presumably the newer models should be able to take advantage of this.
This will work over either a wired connection for the best possible latency, or AirPlay if you don’t mind some latency. This would almost be similar to Sidecar which allows an iPad to act as a secondary display for Mac computers. However, as MacRumors has been informed, using AirPlay might not necessarily be the best idea because of compression and latency, but in a pinch it should be fine.
AirPlay to Mac will be compatible on 2018 or later MacBook Airs and MacBook Pros, and 2019 or later iMacs, iMac Pro, Mac Pros, and the 2020 Mac mini.