I use the PHP packages from sury.org - and you should be able to install those and move Apache etc over to use the newer PHP variant.
It’s possible you might experience dependency problems with something like roundcube, but as I don’t have it installed, I wouldn’t know.