There are two factors to consider when you're thinking about conducting a competitive analysis. The first is timing within the project, and the second is whether you should do the research at all.
First of all, the competitive analysis is one of the earliest research steps in the design process. You can do the analysis before starting to work on a new project. It'll help you plan your project more efficiently.
Since new competitors can emerge at any time, you can iterate on your competitive analysis and continue as long as you're working on that project. You never know what you could find!
And second, you can do a competitive analysis when you're working on a big project with many competitors. Involve your stakeholders in making this decision.