If the program is Python
The question is "How to compare a program's version in a shell script?" It gives gcc as an example. Some answers are gcc specific.
And the excellent general ones with cut -d" " still fail for older Python because prior to v3.4, python --version wrote to stderr instead of stdout. (!!)
Here is a short bash command to check that your Python is at least v3.8 (or whatever you use), that uses Python to avoid both stderr issues and the gyrations involved with *sh string comparison.
python -c "import sys; sys.version_info < (3,8) and sys.exit(1)" \
&& echo "At least v3.8!" || echo "Old version. Do not use."
Note that the version is a Python tuple that beings (major, minor, patch) so comparing to v.3.8.13 would be (3, 8, 13).