If you're new to Linux and aren't familiar with checking log files or compiling software, the following might be a bit over your head. If that's the case, I would suggest trying a newer version of Ubuntu. The newest LTS release, 24.04, just came out.
Check your xrdp logs and see if anything weird is happening. If all else fails upgrade to the latest version of xrdp and see if that helps.
I've been using the enhanced session on my Ubuntu 22.04 VM for years with no issues, but about a month ago xrdp started closing after being connected for a minute or two. I'd have a message in the logs saying the client closed the connection and then xrdp would terminate. I tried reinstalling xrdp from the repos, but nothing changed. After I uninstalled the repo version and built the latest version from source everything started working again.