You are not your grades, or your work, or the idea of yourself that you or others have. Be gentle with yourself, maybe talk to your advisor and some faculty in your major about what you could improve, but don’t take it as a judgment on you, because it’s not. Figure out what you need to do to get where you want to go, let people know about it, and you will sometimes find that the world finds ways to help you. I have great confidence in you, you’ll be fine.