There are some basic administrator maintenance things that should be done before upgrading NextCloud. I first ran NextCloud under UCS so I was not aware of the importance of it at first as I never really needed anything more than the basic functionality.
Before upgrading NextCloud, you should log in as Administrator to NC and run all the updates on the apps and also check the overview in the admin settings for any database maintenance or other items that need to be fixed. Some of the webserver setup recommendations can be ignored if they aren’t important to you.
Once I started checking these things before any update of the app in UCS I have had no more issues with upgrades.
Fixing issues from a failed upgrade can be difficult as it’s not always clear what the particular issue is. I run my server as a VM in ProxMox so I am able to roll back to a previous snapshot when something goes belly up. I highly recommend running servers as VMs. At this point I would not run a server bare metal. The benefits of running as a VM are too nice to go back to bare metal.