Have a CentOS 7 system that is running Moodle 3.1.x and a Moodle 3.5.1 with PHP 7.0.25 right now without errors you've shared here.
What platform is your Moodle running upon?
IMHO, to avoid complications that one would create if successful in getting multple PHP versions running on one server for different versions of Moodle would have to be 'undone' in a short time frame.
Shouldn't leave the older versions of anything up and running ... and accessible ... remember, it's accessible to all on the internet ... good guys as well as the bad guys (and, BTW, I don't practice what I preach with 'sandboxes' ... but I do monitor and protect those older instances as long as it doesn't get to be too much work!)
Therefore (IMHO), the easiest/wisest option is to spin up a new server for 3.5.x -> ... that one moves forward. Easy enough to do *IF* one has internal virtualization ability ... or can afford a remotely hosted VPS setup with any number of providers.
2 cent opinion ...
'spirt of sharing', Ken