There is nothing inherently contradictory about, "Some have been in this world longer than he," with "the world" construed as the whole of Arda. The Ainur did not all descend into Arda at the same time. Illuvatar gave the Ainur the opportunity to enter Arda, but presumably not all did so, nor did they all enter immediately. There is very little specific information about the timing of the Ainur's arrivals in the world—except for the information we have about Tulkas from the Valaquenta, but that does confirm that not all the Ainur entered at the very start:
Greatest in strength and deeds of prowess is Tulkas, who is surnamed Astaldo, the Valiant. He came last to Arda, to aid the Valar in the first battles with Melkor. He delights in wrestling and in contests of strength; and he rides no steed, for he can outrun all things that go on feet, and he is tireless. His hair and beard are golden, and his flesh ruddy; his weapons are his hands. He has little heed for either the past or the future, and is of no avail as a counsellor, but is a hardy friend.
It is also possible that Aragorn could have had access to this kind of information. It is certainly likely that Aragorn had read an in-universe version of the Valaquenta, and it is even conceivable that he had learned about the specific time of Mairon's arrival in Arda (before he was corrupted by Morgoth).
However, I think it is more likely that Aragorn simply may have heard about those very old things from Gandalf (or others among the Wise). Gandalf certainly shared that kind of information with Aragorn later on, in "The White Rider":
Far, far below the deepest delving of the Dwarves, the world is gnawed by nameless things. Even Sauron knows them not. They are older than he. Now I have walked there, but I will bring no report to darken the light of day.
Assuming that Aragorn had learned of the various ancient powers from Gandalf or the Elves, Aragorn had presumably trusted his sources' evaluation of their ages. (On the question of what it meant for their ages to be greater than Sauron's, the answers to this question are obvious relevant.)