This is something I struggled with throughout my PhD, and having a good Director of Studies and having other PhD colleagues around me made a difference. Don't get me wrong, I still struggle with the so-called "impostor syndrome", but I think the key is to surround yourself with people who are supportive, are able to give you positive yet constructive feedback and who can listen to you in moments of struggle.
Something else that can help you is keeping a journal where every day or every week you write down the things you have accomplished. Doing research and being in the industry/academic sector surrounded by very successful people can sometimes feel overwhelming and make you feel small. I did this journal activity in order to force myself to see my accomplishments and it did really help. Otherwise, I always felt life got in the way and all I was able to see was the X, Y and Z that still needed to get done, and not everything else that I had managed to finish.