The function of a religion is to provide
(a) a mythic structure - a spiritual form and vocabulary - that facilitates the exploration of the religious feeling as eidos, and
(b) a church body that enables the living out of that mythic structure thereby facilitating the exploration of religious feeling as morphos.
Eidos means form in the sense of the shape something has in our heart and mind, in our thought and affection. Morphos means form in the sense of the shape something takes in the concrete world and in action.
Religious feeling is never only something uniquely individual. Rather it is something intimately universal. The function of religion, therefore, is also to provide the above in a manner that facilitates
(c) an experience of communion-cum-encounter, within which there is enacted the chemistry of entrusting oneself to the meeting what is other - a transformative event; and
(d) works: co-operation in the service of what are perceived to be intrinsically worthwhile activities, not merely for the achievement of good(s) but as a means of testing faith in the real world.
The function of religion, therefore, is a spiritual maturation of persons, individually and collectively and the provision or co-creation of the forms that enable this. When the forms seem over-tightly drawn, we speak of dogmatism. When they are over-loose we have mere spirituality, a weak creature, and not the fullness of religion.