This has happened to me several times and as much as I've meditated on it, I doubt there's a way to avoid it. There's no way to "thumbnail" audio, you can't rapidly browse en masse and kind of let intuition work in your peripheral sense. I love to compose music but broader audio work such as curating samples/instruments for the composing, and working on sound effects and soundscapes for game development, dealing with 100s of WAVs, while also enjoyable, just becomes overwhelming and time consuming for that reason.
So the example I have is - I didn't watch 'The Silence of the Lambs' since I first saw it when it was released and I was about 12. Some 15+ years later I composed some music and, while I was proud and wanted to use it in the project, I just knew I had subconsciously contrived it from somewhere, I just didn't know where. It bugged me as soon as I finished up and was revising it. A few years later I rewatched the film and bam, there it was. That got me thinking, "How easily this happened. How many times have I done this before? How many more times will this happen? Is this more likely to happen as I grow older? How can I possibly avoid it? What is this 'inner orchestra' in my mind and how can I trust it? Should I even compose anymore?"... That's really frustrating and sad. Are all the great melodies (no matter how quirky) already taken?
As for legal issues - that's a serious question, because in that particular case it was outright and would be seen as blatant. Luckily it did bug me, despite being over 15 years ago, I had a gut feeling about it. So then, if I have the same kind of creeping bellyache when I listen to my other pieces, is that telling me something? As pretentious as this is going to sound, should I bin a piece of music because it's 'too good' and sounds too much like what could already be out there? Again, this topic can really get me depressed. So I guess I'd rather just continue, take that chance, trust my gut a _little_ and tweak some notes until it settles. I still don't even know...