It may be worth reviewing the related Apple Support article:
Universal Control: Use a single keyboard and mouse between Mac and iPad
... and double-checking your settings on both your MacBook and iPad.
Especially that you're logged into both systems with the same Apple iCloud ID with 2-factor authentication, and that both systems are running *both* Bluetooth and WiFi ... and of course, that neither is sleeping as you try using Universal Control!-)
If Universal Control still doesn't work for you, make sure that you're not using a Managed Apple ID, not sharing the iPad's cellular connection, nor that your Mac isn't sharing its internet connection. Also, if you're using Firewall on your Mac, make sure that "Allow external connections" is set, at least for "Universal Control.app" and "rapportd" .