There are different motivations for creating open-source software.
Sometimes you need to solve a problem, and can't find an existing library or tool to solve that. So you create your own. When you later stumble upon a software that solves your problem or can easily be adapted to solve your problem, then it's probably easier to stop wasting your time on duplicating this effort, and use the existing library instead – if it's been around for a while, it is probably better tested and more stable. But why was it so difficult to find? Consider spreading the word with a blog post or a tweet or something.
However, sometimes other libraries turn out to be an unusable broken mess. Maybe the library has some bug that is difficult to fix or work around. Maybe it isn't flexible enough to support your use case. Then it might be a good idea to go back to the project you started, and continue working on it – with the new experience of how not to solve this problem.
A completely different motivation for open-source work is building a portfolio. You want to show what you are capable of. In this case, it's completely OK to build something that already exists. For web designers, it's a common exercise to take an existing site like Google, Facebook, or Wikipedia, and create a new design or theme. Who cares if this has already been done a thousand times? None of those were done by you, and if you can provide an elegant solution to this problem, you can also solve whatever problem someone would hire you for.
For a portfolio project, its important to do the best that you can. Good design, clean code, great documentation, test coverage. This can take a lot of effort, but at the end you have something that you can be proud of. Don't stop because you weren't the first – few projects are truly novel. A portfolio project isn't on your portfolio until you publish it.
Some projects are started to learn something, or try something new. Building something in another programming language, getting acquainted with some framework, experimenting with a design pattern, or building a cool little app. Most of my personal projects are in this category, and most will never be finished. And that's perfectly OK! It's not about getting something done, it's about doing something. You get the most experience long before the project is “completed“.
Sometimes these projects die because more urgent things are happening in life, sometimes they just stop being fun. One time I had to abort a project because I realized I would have to dive into the theoretical background first. If you find an existing project with a similar goal, that shouldn't discourage you. It might be interesting to compare how they solved some problem you encountered. But if you want to stop, then stop.