Anonymous wrote:"You do not rise to the level of your goals. You fall to the level of your systems." - James Clear
I highly recommend reading his book Atomic Habits, which has helped my life tremendously. You need to build on the healthy habits, reinforce them, and make it easy for you to follow them, day after day.
And I just wanted to add that, like you, I have struggled with consistency my entire life. I would do great for a couple weeks, fall off the wagon, etc. And I also used to think that it was a lack of discipline or motivation, but that is not the problem. So I can totally relate.
The key is the systems you put in place to make it as easy and rewarding as possible for you to follow and keep these new healthy habits.