While upgrading from Drupal 8 to Drupal 9, I forgot to uninstall 2 modules that were incompatible. So, when I ran update.php, I was stopped by the errors. Here’s an easy fix to get it to a place where you can uninstall the modules:
Go to the module’s folder and open the [modulename].info.yml file, take out the core: 8.x line (or comment it out with a #), and put in:
core_version_requirement: ^8.8 || ^9
save, then run the update again. This allowed me to get to the backend, and uninstall the modules.