Ideally and basically, religion is law from God -based on that which we do not yet know -which governs behavior, so that catastrophe might be averted while new beings master reality.
The "problem" with religion is that we must choose to obey that law.
We are not pre-programmed to do so, because it is necessary for many reasons that we do the work ourselves.
Because we are essentially born ignorant and each generation must learn the same lessons while also inheriting the state of affairs caused by the previous generations, it is at least nearly impossible for humanity to live as it should -and to prevent increasingly great catastrophes.
The religion of the bible accounts for these things, and explains that by this present experience we will be perfected so that we never make the same mistakes -and will then be given permanence, great creative power and all else we lack.
Our present state essentially limits our ability to affect the universe until it is certain we will not affect it adversely. We live long enough to get the general idea and then a new generation does the same.
Science and religious law cannot themselves solve the problems of the present situation, because they cannot make the necessary changes to the present situation.
True religion in its broadest sense, however, is based on the existence of one with the power to make the necessary changes.
The first change that is necessary is to make newly-created beings obedient to the laws which make peace and happiness a certainty.
That will come by experience of that which is contrary to such -and by education in righteousness (doing things right) after all have been prepared to accept the government of God by realizing its necessity.