If you experience any issues, try the following quick reset step: unlock the iPhone using the passcode, then lock it again. This often helps re-establish the connection and allows the Mac to recognize the device properly for mirroring.
In short, ensure Bluetooth and Wi-Fi are active on both devices, Handoff is enabled, both devices are signed into the same iCloud account, and the iPhone is passcode-protected and locked. Once these conditions are met, iPhone Mirroring should work smoothly.
The following is extracted from this link --> iPhone Mirroring: use your iPhone from your Mac
""
If either device is using Bluetooth or Wi-Fi intensively for another purpose, such as to stream audio or video to another device, discontinue that use and try again. It may also help to check for wireless interference.
Check for VPN and other third-party security software on both devices. Similarly, the firewall settings on your Mac should not be set to block all incoming connections.
iPhone Mirroring system requirements
iPhone Mirroring can only be used with one Mac and one iPhone at a time. Your devices must meet these requirements.
Important: To use iPhone Mirroring, it must be available in your country or region. iPhone Mirroring is currently unavailable in the European Union.
""