I would like to upgrade the OS (Ubuntu) version, how can I do it so as not to damage NEXTCLOUD?
How did you install Nextcloud? Snap, Docker, manual install? Did you document your installation steps?
Generally speaking with a Docker installation and especially with the Snap package, the upgrade should be relatively painless and not affect your Nextcloud directly. And also with a manual installation, Nextcloud will not be destroyed during an OS upgrade. However you can sometimes run into issues with some of the dependencies, especially with the PHP packages. That’s where documentation comes in handy, because then you could use your notes to e.g. simply reinstall PHP if needed and quickly recreate any configuration changes you made to it.
Other than, all I can say is: Create a backup before you start the upgrade…
…if you don’t do regular backups already. Otherwise NOW is a good time to start with it.