Thank you for a good question! You are right, a lot of times they are pretty much interchangeable, like:
１時間 おきに・ごとに トイレに行（い）ったので 全然（ぜんぜん） 寝（ね）れなかった！
-I couldn't sleep at all because I had to go to the bathroom every hour!
花（はな）の 水遣り（みずやり）は 一日（いちにち）おき・ごとで いいです。
-You may water flowers every other day.
However it is useful to know a few things about these two words:
- おき・おきに always follows the number or quantity to express that there is an interval of that number
- ごと・ごとに comes after a noun or an attributive verb to say: every time of
Every night, I dream of Tokyo Olympic Games in 2020.
In this sentence, you cannot use おきに, because it is not a number but a noun 夜（よる）is placed in front.
Hope this explains!