Its worth reading this guide first, you need to carryout the "Manual Upgrade". Also have a read of the "Unsupported Legacy upgrades to Invision Community" section fyi.
Take a backup of your test environment both files and database in case you need to repeat the steps.
Run the compatibility checker, it should complain about your php version.
Disable all 3rd party applications, plugins, themes.
Switch php to version 8 or 8.1, run the compatibility checker again. Everything should ok now.
Overwrite all the files with the new package as described in the manual install.
You may need to clear cache from your ACP Support area afterwards.