As already stated you'll need to use Pipewire to capture the screen under Wayland. There's an extension to obs to add a source for Pipewire screen recording, however I've never installed it on an vanilla OBS installation.
Martin Wimpress, the project leader for Ubuntu Mate, and previous maintainer of the OBS Snap, has created a distribution of OBS for Ubuntu called OBS Studio - Fully Loaded!, it does include the extension I mentioned previously and other bells and whistles. I do use it, and I can't recommend it enough.
Martin has yet another OBS distribution, a portable version of OBS, where he's also adding the extras that you can find on OBS Fully Loaded, it's OBS Studio Portable for Ubuntu, and while it does have some advantages like making it easer to have many independent installations of OBS that you can easily share with others, it does have some limitations that are mentioned on the readme file on the github repository. I have experimented with it, but haven't yet moved my work to it due to lack of time.
Any of these two distributions of OBS would work as you intended.