I've been having this issue consistently for months, and I see a ton of other posts about it but no definite answers. I'm running a 2021 M1 MacBook Pro 14" and a 2021 iPad (baseline model), with macOS 12.4 and iPadOS 15.5 respectively.
I've tried all of the apparent fixes like turning off iPad TouchID and auto-lock, using wired USB connection, etc. Seemed at one point like it was the fact that I had my Mac using both WiFi and wired Ethernet that was the issue, but I stopped using Ethernet and it's still not resolving this.
(Adding to the weirdness, the last thread I replied to about this issue got deleted after an admin posted a cryptic reply about violating the developer beta NDA… but I'm not using a developer beta, and there was nothing in the original post that seemed, to me, to be about a developer beta either… and of course now it's gone so I can't go back and see it.)
The only reason I even bought the iPad was specifically to use it with Sidecar so this is a real pain!