Would the sentence,
The dog is older than the child be translated as
El perro es más viejo que el niño
El perro es mayor que el niño
I think both are technically correct, provided that the context (comparing ages) is understood, but I would definitely favor the first one ("El perro es más viejo que el niño"). There is certain ambiguity with the second one.
Take into account that the dictionary's entry for "mayor" conveys (2nd and 3rd entries) that when applied to people this adjective can be used for describing or comparing ages.
adj. Dicho de una persona: Que excede en edad a otra. Hermana mayor. Marta es mayor que Juan.
adj. Dicho de una persona: Entrada en años, de edad avanzada. Hombre mayor.
The use of "mayor" when applied to animals could imply size and not necessarily age (meaning is bigger and not necessarily is older). That is why the context could be important when you are comparing both individuals. If the context is clear (comparing ages) I don't see any problems with the second option (meaning, I don't think that the second option is necessarily wrong, but I would favor the first one).
Regardless, take into account that in Spanish we don't usually say that "X es más viejo que Y" (as a translation of "X is older than Y"), but we use "tiene más años". So another way of saying the same would be
El perro tiene más años que el niño.