Endgame concluded the story started in Infinity War by jumping forward in time five years to the aftermath of Thanos' win and subsequent death to reveal a much-changed team of superheroes all trying to cope with their loss. Some, like Tony Stark, have bounced back as well as can be expected, but others, not so much. Steve Rogers chairs survivor's guilt support groups, Nat and Thor are in the throes of serious depression and the Clint Barton is a mercenary mass-murderer. So, when Scott Lang shows up with a way to travel back in time, grab the Infinity Stones and undo the Snap, it's no surprise the remaining team jumps at the chance. They succeed, with relatively few casualties, and by the end of the movie, things are (largely) set right. Fans of the Star Trek: Voyager series finale - also titled "Endgame" - might have found the story very, very familiar.
As pointed out by Mike Stoklasa on a recent episode of Red Letter Media's "Half in the Bag", there are weirdly numerous similarities between the MCU film and the Star Trek episode from 2001. In "Endgame," Captain Kathryn Janeway finally gets her crew home from the Delta Quadrant 23 years after the Caretaker pulled them 75,000 lightyears away from home. But the journey was costly and when we catch up with the now Admiral Janeway 10 years after her triumphant return, we learn that she's extremely dissatisfied with the outcome of her journey. So, Janeway takes a bat'leth to the Temporal Prime directive and steals a Klingon timeship and heads three decades back in time to get her crew home a little faster via some Borg wormholes. This results in the elder Janeway sacrificing herself to the Borg Queen, but Voyager gets home faster and all is (basically) well. She even inoculates herself with chronexaline - the Star Trek equivalent of Pym Particles - to guard against tachyon radiation associated with time travel.
Whether the two stories share the same time travel logic will depend on your perspective, but they operate under similar, anti-Back to the Future rules. When Janeway goes back in time in Star Trek: Voyager, she induces her past self to make a different decision which seems to result in a new timeline for the Voyager crew, but doesn't make Admiral Janeway disappear start a time loop. It's not quite as neat and tidy as what Banner and the Ancient One chat about regarding separate realities, but its's pretty clear Janeway and the Voyager crew created an entirely new timeline rather than erasing an old one.
In a less direct correlation, it's worth pointing out that as villains, Thanos and the Borg Queen have a decent amount in common when it comes to family values. They both desire universal dominance at the expense of free will and they both have "adopted" cybernetic daughters who find it extremely difficult to escape their abusive backgrounds. Seven of Nine and Nebula both exhibit the same kind of Stockholm Syndrome toward the Borg Queen and Thanos respectively, and their fight for hard-won independence is a key element in both of their journeys.
In all seriousness, the Tale of Two Endgames isn't anymore more than a series of fun coincidences between two properties that are pretty genre adjacent. But that doesn't mean it's for nothing. After all, many fans are still holding out for the MCU to adapt that X-Men/Star Trek: The Next Generation comic series one of these days.