There are 4 variants of each type of dragon, each corresponding to a specific age. At each age, the red and gold dragons each have the same CR (4, 10, 17, and 24). The dragons are superficially similar, with identical AC, hit points, fire breath, legendary actions, and attack bonuses/damage.
But on closer inspection, it is clear that the gold dragon is significantly more powerful than the red dragon: The save DC for their Frightful Presence is higher, they have higher ability scores, they have a couple more skills. But, more importantly, they have 2 abilities that the red dragon does not: Weakening breath and change shape.
Weakening breath is extremely effective at limiting the combat effectiveness any strength based creature. Shapechange would allow an ancient gold dragon to change into any monster in the Monster Manual (except the Tarrasque) and create equipment for that creature and keep its HP and stellar INT, CHA, and WIS scores and keep its legendary resistance. This is crazy powerful! (Anything that can turn into a noble genie at will should be frightening.)
Another point of difference between the two types of dragons is their layer actions. This is the one place where I would say that the red dragon has an advantage over the gold: The red dragon has a layer action that can cause damage, while the gold dragon does not. (Although that action requires line of sight for the red dragon.) The remaining layer actions are analogous to each other. Both have an action to grant the dragon advantage on attack rolls, and one to waste enemy actions. The gold dragon’s future-seeing is generally better than the red dragon’s tremor because it is guaranteed to work and applies to ability checks and saving throws as well, while the red dragon’s volcanic gasses is generally more powerful than the gold dragon’s banish even though it targets a stronger save because it effects an area, breaks concentration, and doesn’t allow a second chance to break.
The red dragon’s layer actions are a bit stronger than the gold’s, but how on earth are these two monsters the same CR when one of them has access to the entire Monster Manual?