So you failed. So what? Everyone does! Even - and especially - those chosen by God for great works.
Moses hit the rock instead of speaking to it (Numbers 20:1-13). Huge failure. God wouldn’t allow him to enter the Promised Land. Yet God still used Moses.
David committed adultery and covered it up with lies and a murder (2 Samuel 11). Yet God still used David - a man after God’s heart - for good.
As did Peter (John 18:15-27). And Paul, who called himself “the greatest of sinners” (1 Timothy 1:15). And practically all the disciples.
The question is whether or not you admit your mistake. Name your sin. Own it. Learn from it. And don’t - and I repeat don’t - do it again.
Not repeating a sin is called “repentance.” A word that in today’s culture seems missing from most of our vocabularies. But it’s the first word in many of Jesus’s messages (Mark 1:15). It means stopping the behavior that hurts you and God’s heart. Repentance = Stop it!
Repent of your sins. Do it now! Receive the grace provided by Jesus’s death for you on a cross. And do not repeat your sinful behavior.
It is then that your setbacks become God’s steps back on his road of life, recovery, blessing and success.