But I don't think that humans evolved from primates with tails either.
To be more accurate: We lack a tail, just as the apes do because we share a common ancestor who also lacked a tail. We can say this with some degree of certainty because it is a trait all apes share.
If we were to trace our lineage back in time through this common ape ancestor we would likely find an ancestoral species who did indeed have a tail.
It would be more of a case if the fossils were found in the same place, in different layers. When they're found all over the world, it's hard to know, for sure which ones are really older.
The law of uniformatarianism, horizontal continuity and superposition would support which ones are in the same strata, or which ones are younger or older. Dating techniques support where they are placed in the stratigraphy.
You also have certain fossil species which have been shown to have existed for brief periods of time over certain geographical ranges. If I find a trilobite species in the rock in the same horizon as my target fossil, I know it "the target fossil" has to be within a certain age range. I can pinpoint the age of the fossil by using other dating techniques, by dating the matrix surrounding the fossil.