This is unfortunate, but chess.com does not take into account the length between each move, just whether the board looks the exact same three times.
Draw by repetition even though repeats were six moves apart?

Ok well thats good to know. However, if that is the case why wasn't the move Ra3 flagged even though it occurred 3 times in that span as well? And does it only need to be 1 person who repeats for it to cause a draw? I dont believe I was repeating my moves which is why I was so surprised.

You had a winning position - past tense, "had." Once you allowed the repetition, you blundered away the win, same as if you had blundered away your queen.
In this game, you actually could have won... you didn't have to allow the repetition. Granted, you didn't correctly know the rules of a repetition draw, but now that you know a repetition can happen even with many moves in between, you can try to avoid them (or implement them if you are the one at a disadvantage).
If you had continued your king up the board, eventually black wouldn't be able to continue the checks. Once you can avoid the check, you can promote your c pawn and go on to win fairly easily.
The rules for a repetition draw:
1. It is the repetition of POSITION, not a repetition of MOVES. This is a common misconception. This means that a) a person moving a piece back and forth by themselves can't repeat the position, and b) it doesn't have to be the same move that creates the repetition (e.g., Kc3, Rg6, and Qa2 can all end up creating the repetition of position, even though none of those are a repetition of each other). In your game, Ra3+ wasn't flagged as part of the repetition is because your king was on different squares (g3 once, then f3 twice).
2. A position is the same if the following conditions are met:
a. All pieces are on the exact same squares - a photo of the board state looks the same each time.
b. The same castling options remain available. If you can castle kingside the first time, but you move your kingside rook or your king, then even if the board looks the same later on, it isn't the same position.
c. En Passant available/unavailable are different positions. Since En Passant is only available immediately, any later position is not the same as the first position (though later ones may be the same as each other; in this case it feel like a four-time repetition).
d. The same side is to move. If in one position it is white to move but in another it is black to move, then it can't be the same position even if the other conditions are met.
3. On this site, 3-fold repetition happens automatically. Formally, in an official tournament, you can claim the draw before you make the 3rd repetition by noting it on your scoresheet, stopping the clock, and calling over the arbiter/TD. You must have an accurate scoresheet to be able to make this claim. If the 3rd repetition is played on the board, the other player may then claim the draw or continue the game. If they continue the game, then you may lose the opportunity for a repetition draw if they diverge from the position.
Now, why is 3-fold repetition a draw?
It's simple - progress is not being made in the game. It doesn't matter if you have a massive advantage in material/position. If you can't make progress towards a win, then you don't deserve the full point. If your opponent can pester you with infinite checks (or even just threats - repetitions don't have to be the result of perpetual check), then they have managed to save a half-point. You must remain vigilant the whole game - they say that the hardest game to win is a won game, and 3-fold repetition is a part of the reason for that.
Drew this game due to repetition, but the third repeat caused a draw even though it was 6 moves after the last repeat. Seems absurd to me that it caused a draw, and really frustrated that they could do that when I was in such a winning position. Could anyone explain why this happened?