The team is also tired. Many resignations. They feel the work done today will be scrapped tomorrow.
Follow your coworkers to a new job. You're not motivated, and your mental health has taken a hit. These are 2 clear signs it's time to move companies.
EDIT - I don't think you will last much longer here. Plan your escape.
The CEO is a bad manager. It sounds like your CEO is not on your side.
On different occasions my founder made comments like "you wasted so much time. But still I am ok with it. I am giving you one more chance"
He's likely planning to fire you soon. You need an escape plan. Your issue withis with your CEO, not the other team.
This sounds like a terrible company to work for. The CEO is pitting 2 teams he's paying against each other. Smart people are quitting and finding a job where the CEO values teamwork.