I used to worry a lot about being scooped. Now that I am more seasoned, I don't worry quite as much. Even when other researchers are working on similar problems as me, we generally end up with different papers.
When I start working on a project, I try to get my own ideas organized before I look at anyone else's work. That way, my ideas are my own. Once I sort out the problem I am solving and how, then I look at what other researchers have done or are working on. Generally the overlap is slight, but if it is too much I may ditch the project. A problem with that approach is I may rediscover some previously known result.
If someone else is doing something similar, we generally end up with different papers. And that has happened to me a few times. I don't know if that means that I am quirky, or just out in left field. But I do know that when I am intellectually happy with my paper, the outcome tends to be OK. Although it may be stresful getting to the final outcome.
All this is why I now tell students to get their own ideas sorted out, then look at everyone else's papers and then get going. It works out fine as long as the students are well-trained in the basics of the field. And for me, well-trained means deep knowledge of the basics.