Macedon was annexed following the Fourth Macedonian War and the defeat of the pretender Andriskos, who claimed to be a son of king Perseus; the last recorded members of the Antigonid dynasty were an Alexander, son of the late king, and Philip, half-brother of Perseus as the youngest son of Philip V. Livy accounts that they were made prisioners and confined in the city of Alba alongside Perseus, and lived the rest of their days there -Perseus was killed by the Romans not long after, but his brother and son were not. Livy says that Philip died some time after Perseus, while Alexander, who was still a child, grew up and became a public notary in the city.
The last Ptolemies were the sons of Cleopatra by Caesar and Mark Antony, this is, Caeaarion and Alexander Helios, Ptolemy Philadelphos and Cleopatra Selene. Caesarion was put to death by Octavian soon after the suicide of Cleopatra for obvious reasons regarding legitimacy as sons of Caesar; the fate of Alexander and Ptolemy is not so clear, as they were apparently spared by Octavian, at least for some time, but they were taken to Rome, where they could pose no threat, and the record on them becomes quiet after that.
Their sister, however, is easier to follow: Selene was married to king Juba of Nunidia and had a son, Ptolemy, who was king of Mauritania until he was executed on the orders of Caligula in 40 CE. His only daughter, Drusilla, married the syrian priest-king of Emessa, Sohaemus, extending through their offspring the blood of Ptolemy up until the late 2rd Century and merging with the aristocratic elite of the Empire. Some of their descendants, although the lines are, again, not too clear, would be queen Zenobia and the emperor Elagabalus
Tracking the last Seleukid is, as usual, a bit more difficult: the last half century of existence of the Kingdom is messed up by continuous dynastic conflicts and civil wars, and the very last scions of the family are particularly obscure due to lack of sources. The last recorded king was Philip II. He had been competing for the throne with his cousin, Antiochos XIII, until he was executed by Pompey in 64 BCE during his eastern campaigns, in an attempt of restoring order in Syria. When this proved unsuccesful, he also deposed Philip, who may have survived, although there are no clear evidence of it.
Some years later there appears in the ptolemaic court a certain Seleukos Kybiosactes, who some historians have identified with the elder brother of Antiochos XIII, Seleukos VII, who had ruled before him until Tigranes of Armenia conquered Syria. If we were to accept this, we should assume that would've been deposed, either by Tigranes or by his brother, and exiled to Egypt, where he then reappeared as the husband of Berenice IV, sister of Cleopatra. Again, the evidence is way too thin, but seemingly this Kybiosactes could've been the same Seleukos; anyway, his was not a long journey either, as he was put to death by his wife in around 58 BCE. This Seleukos would have been the last recorded male member of the dynasty.
However, I think it's worth mentioning that the Seleukids were not as closed dynastically as the Ptolemies: through Cleopatra Syra, daughter of Antiochos III, the Seleukid bloodline merged with the Ptolemaic one, and other marriages between Seleukid princesses and foreign monarchs resulted in the matrilineal continuation of the bloodline (not of the dynasty, though) through the royal families of Pontus, Capadoccia and Commagene, this one lasting for well over a century after the dissolution of the Seleukid Kingdom.