In Magento 2 stores, helper classes provide functionality for a variety of functions. The Helper can be invoked in controllers, models, views, and other helpers with Magento 2.
If you want helper data in a Magento 2 .phtml file, you can use the shared code.
Making changes to the core Magento 2 files is not advised, which is why the Magento 2 Helper class was created to replace them.
To add unique functionalities and improve shop features, use the programmatic way to invoke helper function in phtml Magento 2, By visiting: https://meetanshi.com/blog/call-helper-function-in-phtml-in-magento-2/