Upgrading Nextcloud: Can I upgrade and migrate in one go?

It should be possible if you don’t skip major NC versions. E.g. if you go from a system with php 7.4 to a system with php 8.2, you can use NC 25 on the old system, then do a migration and manual upgrade at the same time to NC 26:

(but you can go from NC23 to NC 26, if you want to go from php 7.3 to 8.2)

for the manual upgrade: Copy database, datafolder and config folder to the new server. Then put the new code of the new NC version: Nextcloud server changelog
Place the new code, fix the permissions if necessary and run the occ upgrade command.

It is good if you still have the old server running until your new server is working. Keep a full backup!