From a sociological standpoint, religion serves the purpose of binding groups together. For most people in the US today, politics functions largely the way religion does.
People face the persistent problem of determining whom to trust and also ensuring that others are trustworthy. In a way, life like a series of prisoners' dilemma games; we constantly have the opportunity to secure a short-term gain by lying, cheating, and stealing. It is also like a series of public goods games; we constantly have the temptation to under-contribute or free-ride on collectively-produced goods. We need to work together to flourish, but we rationally worry about whether we can trust other people to keep their word and do their part. What we need are reliable signals that others are both trusting and trustworthy, and we need something that actually induces them to be more trusting and trustworthy.
Religions help bind groups together by creating mechanisms for expensive signaling of loyalty and commitment to the group. Imagine an indifference curve between expensive rituals and expensive beliefs. Most religions fall somewhere along this curve. Some emphasize ritual more than belief (think contemporary Shintoism, though my understanding of it may be wrong), while others emphasize belief more than ritual (many forms of fundamentalism Protestantism), while others are sort of in-between (more orthodox forms of Judaism). "Rituals" here include: restrictions on dress, required ceremonial activities, require abstinence from various pleasures, ceremonial mutilation, and so on. "Belief" includes an emphasis on bizarre, fanciful, or absurd metaphysical claims. The fact that someone strongly sticks to the rituals and/or seems to sincerely believe in the absurd metaphysical claims helps demonstrate that they are loyal to the group, will conform to the group's expectations, and are willing to play along. The same goes for sticking to expensive rituals. As a result, we reliably repose trust in them and they in us.
Such behavior is common even outside religions. Consider that even criminal gangs, such as MS13, have required tattoos and required rituals. These bind members of the group together and ensure loyalty within the group.
For most people, politics is not about a sincere commitment to policy. Very few people start with an ideology and then select a political party on the basis of that party. Instead, the overwhelming majority of people join political parties for non-ideological reasons. They are themselves ideologically innocent, have few stable political opinions, don't know what their party stands for, and so on. But they nevertheless greatly benefit from being seen to be fans of whatever party their group is associated with.
Even most more seemingly ideological voters are usually not genuine ideologues. Rather, they simply parrot whatever their party happens to be advocating today, and insist it is what they always believed. But if their party changes its mind, they will do so as well, and again claim it is what they always believed. This behavior does not result from using cognitive shortcuts or heuristics. It's about conforming to the group.
Politics produces all sorts of social rewards. Voting is like praying in public. Loudly proclaiming one's hatred of the Republicans functions, in Democratic circles, the way bashing Islam functions in certain Protestant circles (or vice versa). Straw manning and avoiding outsiders demonstrates purity and that is one is unlikely to leave the group, which in turns demonstrates commitment and trustworthiness within the group. Believing whatever mix of bullshit ideas your party masters are pushing today, and switching one's beliefs on the spot, demonstrates loyalty. A willingness to vote for the party without even knowing what it says does so as well. (Consider how many people claim to be Biblical literalists but then, when you ask them, have read very little of the Bible.) Declaring that one's side is obviously right about everything is sort of like saying of course you believe Christ is God; it's simply obvious. It is a way of signaling fidelity to the group and moral superiority within the group. After all, within any religious group, the true believers and the observant have higher status.
If you think of politics as an attempt to realize independent political goals, it's very hard to make sense of most people's actual behavior (including their ignorance, unscientific reasoning, bias, tribalism, conformism, grandstanding, and so on). If you think of politics as a surrogate for religion; as a mechanism to bind and blind, their behavior makes lots of sense.