Was thinking of Planet of the Apes and them not realizing that they just returned to Earth in the future. Say you need to know where you are, and hence where Earth is, and thus which direction to head off on to get back (assume your vessel has Trek-style warp drive).
If the other system in question is nearby it can probably be a cinch, just note the modest type F star in a constellation that normally doesn’t have such, and where Sirius and Vega and Alpha Centauri are at now, and that assumes you cannot ID the star you are in orbit around.
A lot depends on how much data you have-Sirius’ spectrum and white dwarf companion could probably help identify her without too much trouble.
5,000 light years away, and you would presumably have a lot more trouble. Orion Nebula? Eta Carinae? Deneb? Various globular clusters would probably be your best bet.
What if however you are on the other side of the galaxy? Then you would need M-31, M-33, and probably most Magellanic Clouds, assuming they aren’t all blocked by the Milky Way itself.
Was already thinking of starting this topic when I spied this post by @LSLGuy about navigating on the moon vis a vis where Earth is: