"Oh, my God" is slightly rude. It used to be considered very rude.
In English, there are three kinds of bad language: vulgarity (bathroom words), obscenity (sexual words), and profanity. Profanity means the casual use of religious words--God, damn, hell, Jesus, etc. "Oh, my God" is an example.
"Gosh" is a euphemism, a substitute word. There are a lot of them. Many of them resemble a quick correction. You have started to say "God," it is too late to stop yourself, so you change it to "gosh." You have started to say the f-bomb, it is too late to stop yourself, so you change it to "fudge." "Hell" becomes "heck," "damn" becomes "darn."
Nowadays, there are very few taboo words, and using these substitute words is starting to sound old-fashioned or babyish.
My grandson keeps saying "Oh, my God." It just doesn't sound right for a little kid to be saying it. Whenever he says it, I stop him and correct him: "Oh, my gosh."