Both your devices are too new. The very restrictive hardware and macOS conditions for what you want to do, Target Disposal Mode, are laid out in this Apple article:
Use your iMac as a display with target display mode - Apple Support
Of the five options listed in the 9to5Mac article, only the external monitor is appropriate. SideCar is about iPads. AirPlay to Mac has proved to be laggy, as are the two third-party solutions.
+1 on just getting an eternal monitor so you are not struggling with the other options.
Apple started the deprecation of Target Display Mode in late 2014, and threw the last shovel of dirt in its face in early 2020.