An exception occurred in the driver: could not find driver in /var/www/html/lib/private/DB/Connection.php:142

When you upgrade php, make sure you also install all the required php extensions for the upgraded version. The Ubuntu specific instructions might be useful:

https://docs.nextcloud.com/server/stable/admin_manual/installation/example_ubuntu.html

The full module list is here just in case:

https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation

I suspect that error is because you’re missing the one for your database, but you’re likely also missing the rest if you upgraded.