A two party system is an inescapable consequence of the plurality voting system (aka first-past-the-post voting) which is the system used by nearly all states and districts in the US, and much of the rest of the world. To fix the two party problem, the first step is to change the voting system. There are a number of alternative voting systems, each with their own pros and cons and situational uses. For legislative bodies, boards, or any other elected committee, I'm partial to proportional voting. And for single seat elections, I think approval voting is the ideal.
The thing that makes approval voting and other single seat voting systems better than plurality is that you vote for everyone you like. The way that that vote is cast and counted differs between systems. But in all cases, the benefit, ideally, is when 3 or more candidates exist for a seat, it prevents the least popular candidate from winning just because the other more popular candidates split the opposing voters. If you vote for each candidate you like, the candidates are never splitting the votes. The funny thing to me about most of these other fairer voting systems is that, while they are susceptible to a sort of spoiler effect from overly strategic or cynical voters who will simply only support one candidate, the result of that is just plurality voting, which we already have now. In other words, our current system is the worst case scenario for other, better, voting systems.
Some good videos on these systems...
CGP Grey video series: https://youtube.com/playlist?list=PLej2SlXPEd37YwwEY7mm0WyZ8cfB1TxXa&si=drEjNlgriHGg8feS
Primer video: https://youtu.be/yhO6jfHPFQU?si=IZNs8AAp3Xlif23X