The previous advice is more of a band-aid than a real solution. I had the same error in the past, but only with ImageMagick. What solved it for me was recompiling all PHP versions, that fixed the issue. I also updated everything to the latest version.
In the CWP panel, go to PHP Selector, PHP-FPM Selector, and even PHP Version Switcher, then rebuild each PHP version you have installed. You can also update everything to the latest versions. Do it one by one and check if the error is resolved after each step.
Before doing that, connect via SSH and run the PHP version directly in the console to see if the error appears, it usually does. Then update and try again.
You can use a command like:
/opt/alt/php83/usr/bin/php --version