Those who follow a religion seek to make it a guide for how they live their life. Politics is where enforcable laws are defined to rule how others live their lives. Problems can occur when the two meet.
While people are generally gregarious, living and working in close quarters with each other gives rise to disputes, sometimes with fatal consequences. While such problems can be handled on an individual basis, the numbers occurring means that some set of formal processes need to be in place.
In early societies, such processes were defined rather autocratically by those charged with carrying out the administration of the person in charge, who was typically someone who had fought their way to the top, or had inherited the position. Everyone else was obliged to obey, unless they successfully revolted and installed another autocrat.
However, as people decided that autocracy was not the system they really wanted to live under, people, and especially philosophers, started discussing what the best societal structure would be. Politics was born. Democracy eventually became the most popular structure, mainly because it allowed people to contribute to all of the political discussions.
Each person brings their set of beliefs to such discussions, so their religious beliefs play a large part in what they think should be how people conduct themselves in life, in private as well as public.
The real problem occurs when attempts to define what people should believe are proposed, mainly because beliefs are subject to free will, which cannot really be controlled by any human laws.
Wars have been fought over which beliefs should be officially prescribed and which proscribed. That a government can define what people believe en masse is absurd, but people still vote to enshrine such religious biases into law, unnecessarily curtailing people from performing the physical expression of their beliefs.
Such laws lead to the next problem, which is that it purports to limit people from evolving their thinking, which can lead to efforts to change laws. Society cannot evolve to serve its citizens in better ways if such thinking-limiting laws exist.
Of course, religions are not just about beliefs, but also what they prescribe as required behaviours and physical attributes that are supposed to prove that a person is a legitimate follower of the religion, so adherents want them enshrined into law.
The problem is that such behaviours and attributes are not proof of belief, but may only possibly be indicative. Making them law therefore forces people who don't believe to deny their own beliefs and fake their allegences, or face punishment.
Enshrining religious beliefs and behaviours into law interferes with legitimate political processes in a democracy, as they make it more difficult to move on from them if people want to. For example, the resistance to same-sex marriage is typically based upon not disrupting tradition, but also upon biblical interpretations that don't reflect the use of the words in the Bible.
The result of the intrusion of religion into politics is the conflation of religious freedom with exemption from laws designed to prevent discrimination, such as excluding women from some activities, or imposing restrictions only on them. Allowing freedom of religious thought and practice is not the same as freedom to be unfair or discriminatory, especially since most religions are based upon unproven assertions, and not empirical evidence. Beliefs, even when widely held for millenia, are not necessarilly true, just a mass opinion.
Religion, like any other ideology, can rightly inform the thinking that goes into making laws, but care must be taken to ensure that it does not unduly corrupt the implementation of fairness.
Democracies are based upon serving mass opinions, but, for their own health, they need to avoid embedding discrimination or favouritism that disenfranchises its citizens, because it sets a precedent that may result in some of the approving people becoming the next to be suppressed.