First thing first, you should not use Object Manager, this is a bad practice and its direct usage reduces dependency visibility and prevents type validations and hinting.
Secondly, you should not use helper classes to load any data as it is a bad practice as well.
Instead, your code should adhere to the MVVM pattern, please read more on the topic in https://weblizar.com/blog/magento-2-is-model-view-view-model-system-and-not-mvc-explained/:
The Magento block object serves as a ViewModel if you speak
specifically about the MVVM system. The object block is capable of
scanning and reading the business models, user requests, acquiring
data from external system, etc. the template file is termed as View
that solely collaborates with the block object that is the View Model.
LE if you don't go with the MVVM approach due to version usage (which was pointed to me in the comments - thanks @paj), I suggest you add the code inside a model class, which you can call from a block class associated to your phtml (similar to what you would have implemented in m1).