Ps 51:11 Do not banish me from your presence, and don’t take your Holy Spirit from me.
With everything David had done is it surprising that he felt far away from God? Sin and guilt can make you feel that way. As a young man, he was evicted from his home and exiled from the palace by King Saul. However, this was different. During those times David was innocent but not now. Unconfessed sin makes intimacy with God impossible.
We think no one sees what we do, God sees all. By his grace he allows us to work through the problem we caused, as long as in the end we see the sin for what it is and ask forgiveness. If not he must step back and leave us to the consequences of our actions.
Total isolation from God is the worse feeling I can imagine. I pray and thank God every day that his Holy Spirit shows me when I mess up, and sometimes, I REALLY mess up. But the presence of God is always there, waiting for me to come to him. Never be afraid that your situation is unforgivable or impossible for God to take care of. I serve a big God, and believe me, he has dealt with bigger things then you can imagine. He created you and God doesn’t make mistakes. No matter what you were told in the past, God is waiting for you to come back in his presence in prayer, ask forgiveness and reconnect with him.