Recent releases of GNOME on Ubuntu, and presumably in other distributions as well, finally support remote access to your GNOME desktop on both Xorg and Wayland from a VNC client. However, they do not allow you to connect to your desktop when it is locked, and similarly if your desktop locks — either because you lock it manually or because you have it configured to look after a certain amount of idle time — while you are connected, you’re disconnected.
There are legitimate security reasons for this: if you connect to a locked desktop remotely and unlock it, then it’s unlocked both in the remote desktop session and locally, which means anyone with physical access to your computer can walk up to it and mess around.
However, although there are obviously circumstances when this isn’t a substantive concern, the GNOME maintainers have not (yet) added a configuration session for people to allow remote connections to their locked desktop if they feel it is safe to do so.
I’ve written a GNOME Shell extension to do this. When the extension is installed and enabled, you are able to connect remotely to your locked desktop; when it’s not, you can’t. It’s that simple.