Unfortunately, the 3-year rule under INA §319(a) requires you to be living in marital union with the US citizen spouse for three continuous years before filing N-400, AND at the time of filing. Divorce before filing automatically removes you from this category — regardless of how long the marriage lasted.
What this means: you'll need to wait the standard 5 years from your green card date — October 2023 — so you can file from October 2028 (or up to 90 days earlier, around July 2028).
If you have a 2-year conditional green card, removing conditions through I-751 is a separate issue. After divorce you'd file with a "good-faith marriage that ended in divorce" waiver. Resolve that before counting toward citizenship.