A bug I noticed with Wayland enabled on Ubuntu 22.04 caused Discord screen sharing to show as a blank black screen. To resolve this you need to disable Wayland. To this, edit the following file:
nano /etc/gdm3/custom.conf
Under the daemon section, set WaylandEnable to false as follows:
WaylandEnable=false
Finally, save the file and restart GDM3 with the following command, or simply reboot your machine (recommended):
systemctl restart gdm3