Religion is so many things and have been so many things. Worse yet, it is thought to be so many different things.
Religion will probably never again serve its earliest, most important practical function. That of keeping track of the season so that early farmers with know when to plant their crops. Still, in the context of a long-term stable ecology, religion will retain many of its traditional functions and almost certainly acquire important new functions.
Religion is meant to be conservative. It is an institution whose functions include the most basic human needs. It manages births, deaths, marriages, families, communities and so many other methods for parts of morality, the ways by which humans live.
When the world seems consumed by materialism and kinetic values that are of no importance to real human survival, it is religions that must retain and husband the universal values that lead to human survival. When demagogues seek to fool us, it must be religion that sees their fraud clearly. When humans forget, it is religion that must remember.
A person who commits themselves to religion is committing themselves to serving humanity. Religion is not primarily to serve God other than how religion fulfills God's purpose by serving humans. Religion serves humans in the name of God by teaching morality that was given to humans as a gift of God. That is one of the greatest responsibilities a person or institution can take upon themselves. Religion and people of religion must hold themselves to the highest standards, because religion is about the survival of people. At the start of this discussion of morality it was stated that moralities are the learned survival strategies that are essential to human survival. This discussion of morality was going to be based strictly on a view of survival rooted in biology. Yet at the same time it was said that the moralities taught and husbanded by religion were the most advanced survival strategies currently available to humans. At different times, religions have done better or worse jobs of teaching morality. In the context of a stable ecology, moralities will become better understood in terms of reason and functionality upon which they are based instead of the authority and precedents that they have relied on in the past. As such religion should have an easier time successfully teaching morality because we will have a much better understanding of the requirements of survival that are the basis of morality.
Other ways that religion may serve God are discussed elsewhere in a further discussion of God.
Religion will naturally take on new functions as new factors arise in human survival, notably artificial selection.
There are some extraordinary challenges to human survival that we will have to deal with. Hopefully, religions can take on some more new important roles in their traditional function of aiding human survival. Besides their important traditional role of teaching morality and faith, they may be able to take on roles that cannot be left to the short sighted or the easily corrupted. That may include the genetic information critical to families, communities and humanity at large that will be used for artificial selection.