We have an environment with different PHP versions and php is linked to our latest, probably not suitable for the Magento version we are working on or with other ini-settings applied.
We just start the Composer bin/magento script with a custom PHP executable, eg. php7.4
So instead of php as executable use the current executable which was applied by the user.