It's a real shame they got rid of target display mode. But then people would hold onto iMacs even longer.
Today, you can use software like Luna or Duet, or native screen sharing to control an iMac from another Mac (or vice versa). I have a 2019 iMac, bought for pennies and upgraded after to max out; way better value than buying the display on its own or a comparable monitor alone. The screen quality is just great.
I use it both as a daily driver and as a "thin client" for all my other machines with the software above.
They are never as good as native input. There are a lot of compression going on that reduce image quality and increase latency.
Also they require software on both sides, so if you want to use your imac to display your computer BIOS, no.
I wonder if Apple dropped it because of some proprietary licensed IP, such as Intel WiDi, making the feature possible.
opendisplay - https://github.com/peetzweg/opendisplay - can make a old iMac's screen useful again. In my case, a 2015 27" iMac can be used as a monitor for my modern Mac laptop, connected via ethernet cable.