I read this short story about 10 years ago.
A young female starship officer wakes up after an attack by the dreaded mysterious alien enemies. She finds only part of her ship still in existence, and somehow joined on to bits of other ships populated by either completely unknown species, or humans from different time lines - I think one man was from an Indian-dominated world.
Eventually she finds the captain of the joined ship and realises it is a much older version of herself, who has been looking for the younger one for years: apparently only she can take over.
The captain explains that in every universe there are the same aliens, and whenever they attack a ship it gets shifted into another random universe where it joins with the existing amalgamated ship. Engineers fix the new parts together properly and then they all go in search of the aliens again to get blasted into yet another universe. Each time, some of the races that are already on the ship find that this is their universe and so leave to go home.
I think the ending shows that the story is being recounted by the new captain, now old herself.