the PySpark error message is misleading and, as you have correctly identified, is caused by a different OpenSSL version being present in the Conda environment and the Foundry Build's environment.
Newer version of Python Transforms ship with OpenSSL 3.4.0, so you can fix this issue by making sure you don't pin the openssl version in your meta.yaml file and by upgrading your repository to the latest template version.