I believe you are thinking of the Enterprise episode E2.
The starship Enterprise encounters a future version of itself that, due to a temporal phenomenon, had been sent back 117 years into the past. This Enterprise was originally identical to the "real" Enterprise, with the same crew, but had been sent back in time after entering an unstable subspace corridor. For decades it existed in the Expanse, never contacting Starfleet,1 waiting to catch up with the current Enterprise and warn its past self about the wormhole. The only crewmember to survive through the decades was Sub-commander T'Pol, who finds she has the privilege of meeting a less aged version of herself. All of the other inhabitants of the ship are descendants of the original crew (some of whom have interbred with friendly aliens they encountered along the way). For example, Lorian (David Andrews), the captain, is the son of Commander Tucker and T'Pol. As such the Enterprise has become a generational ship.
Compare to your description:
The crew somehow get trapped in some kind of altered time state (either time slows down or they get put in another dimension)
Sent back in time
The only way to fix it is to wait until a future point in time.
When their future selves get to the same point
So they end up living most of their lives into old age on the ship. Several characters get married and develop close relationships.
Yep, generational ship
Finally the one character who ages the least (I think Worf, but it may have been a Klingon like character)
T'pol, at the ripe old age of 200-something.
has to warn the crew from the different dimension not to do something that will cause the time-disturbance.
(Don't) fly into the nebula