As I understand it, both words are used to express "too", "too much," or "in excess" (depending on specific context).
Are these words synonymous, or is there a subtle difference I am missing?
In the sense of too, too much, in excess, demasiado is an adverb and an adjective, and as an adjective can take the forms demasiado/a/os/as. Demais is an adverb only.
However, sentences with the adjective demasiado can be transformed into sentences with the adverb demais or the adverbial phrase de mais:
(Especially ptPT) Passam demasiados carros nesta rua = (esp. ptBR) passam carros demais nesta rua = passam carros de mais nesta rua.
Contrary to common practice in Portuguese, demasiados carros sounds more natural than carros demasiados, but you don't say passam demais carros nesta rua.
As an adverb, they are indeed synonims, but are sometimes differently located in a sentence (see third example).
Comi demasiado = comi demais = comi de mais
Amo-te demais (ptBR, meaning very much, not too much).
Esse bar é demasiado longe = esse bar é longe demais/de mais.
Don't ask me why you can't say esse bar é demais/de mais longe. It just doesn't sound right.
Some in Portugal and some in Brazil argue you can use de mais only for quantities (so, carros de mais but not longe de mais) and demais only for intensity (so, longe demais but not carros demais), but others especially in Brazil, but in Portugal too say carros demais is just fine.
Demais has other unrelated uses. As an adverb it can mean furthermore (rarely used); as a noun or adjective as/os demais means the others or the other (something). It is not interchangeable with de mais or demasiado in these senses.