Marrying a U.S. citizen is a common path many people take to become a U.S. citizen themselves. The point of immigration laws pertaining to marriage and citizenship is to allow you and your spouse to live in the U.S. without issue.
However, if your marriage is not going well and you decide to take steps to end it, this could affect your ability to become a citizen.
According to U.S. Citizenship and Immigration Services, if you and your spouse divorce, then you no longer retain the eligibility to naturalize as the spouse of a citizen. This applies even if you file your application prior to the divorce.
Perhaps you decide not to divorce, but you do separate. If it is a legal separation where you have a court order, then you likely will no longer live together. One of the requirements when naturalizing as a spouse of a citizen is that you must live in a marital union.
Living in a marital union basically means that you share a household and all the household responsibilities. Once you legally separate, you are no longer living as a household and lose your status as a spouse for naturalization purposes.
Even if your separation is informal, which means you do not involve the courts or legal system, it might still impact your naturalization options. If you stop living together, then you break the requirement to live in a marital union. If you live together, it may still have an effect on you.
The considerations to determine if your separation makes you ineligible include whether you or your spouse are in a new relationship outside the marriage, if you or your spouse intends to end the marriage, how long the separation has been effective and what support you provide to your spouse and children.