Science and religion are both tools, or perhaps toolkits.
Science is used for finding out how things happen, and using that knowledge to create technologyof various kinds. It tends to be directed by the societies in which its practitoners work and its' end products - technologies -are geared toward that societys' aims.
Religion is used to reinforce political and social ideologies with a view to ensuring that those in power stay in power. It produces rules of conduct - morals- which are based upon the culture out of which it arises. Thus many current major religions preach morals designed to perpetuate patriarchy.
The growth of education created a larger population of people able to think critically, and this has had effects on both.
Science has been constrained to broaden its scope in order to produce technology of more benefit to people a a whole, rather than the elites (which is why most of us in the West now have indoor plumbing).
Religion has had a harder time, since its foundational narratives do not stand up to close examination by the educated. Further, it has been noted that people do not need the hope of Heaven or the fear of Hell in order to behave well. A proper secular education can provide rational and practical reasons for ethical and moral behaviour. Unfortunately, these reasons do not grant exemptions from moral behaviour for the wealthy and powerful, as religions commonly do. Which is why Conservatives push religion and seek to limit education to the acquisition of basic mechanical skills.