If you have several version of PHP installed, you can switch between them at anytime.
For this example, I have have installed PHP 7.4 and PHP 8.0
To change between them you use the update-alternatives command which will display available versions and let you choose which one you want active:
sudo update-alternatives --config php
To test the active version simply run:
php -v
You also need to tell Apache which module to enable. Below are the commands to disable PHP 7.4 and enable PHP 8.0:
sudo a2dismod php7.4
sudo a2enmod php8.0
sudo systemctl restart apache2