Don't let this thought worry you any longer -- and it won't, once you realize what Jesus Christ actually did for you on the cross.
Admittedly Jesus' cry from the cross seems strange at first: "My God, my God, why have you forsaken me?" (Mark 15:34). How could God turn His back on His only Son (which is who Jesus was)? During all His time on earth up to this point Jesus had walked in perfect fellowship with His Father -- but now that fellowship was broken. How could this happen?
The key is to realize that when Jesus died on the cross, He became the final and perfect sacrifice for our sins. He was without sin, because He was God in human flesh. But on the cross the sins of the whole world -- including your sins and mine -- were placed on Him. He took upon Himself the death and judgment you and I deserve. We deserved to be on that cross -- but He took our place. And because our sins were placed on Him, God had to turn away. A holy God could not remain in the presence of sin.
But because Christ took the punishment we deserve, we don't have to take it! God has already dealt with our sins! If you have never trusted Christ for your salvation, pause right now and ask Him to come into your life and forgive you -- and He will.