Anything on php7 should be good to upgrade to the latest version of php. You may need to update some include files to the latest version but this would be named in any errors and can be updated with the latest extensions.
MySQL version can always be updated to latest the only issues I’ve seen there are different configuration settings that may have to be updated for complex queries.
The only difficulty comes when updating from pre php7 to pho7+ because all database interaction has to be updated to MySQLi.