During WWDC 2022, Apple introduced a new feature for MacOS called Continuity Cam that lets users easily turn their iPhone into their MacBook's webcam.
Source: Youtube