Rather than converting your Android phone into a camera, it might be simpler to get a more costly webcam. You may also wait until Android 14 if the latest discoveries are correct.
Using an Android phone as a webcam became really popular during the pandemic, but you've typically had to install a third-party app to do so. You may not have to do this in the future, though, as Google is adding support for turning Android devices into USB webcams!
— Mishaal Rahman (@MishaalRahman) February 2, 2023