Sounds like Poul Anderson's novel Tau Zero. (A shorter version was serialized in Galaxy Magazine as the novella "To Outlive Eternity".) Here is a plot description from Wikipedia:
Tau Zero follows the crew of the starship Leonora Christine, a colonization vessel crewed by 25 men and 25 women aiming to reach a distant star system. The ship is powered by a Bussard ramjet, which was proposed shortly before Anderson wrote the book. This engine is not capable of faster-than-light travel, and so the voyage is subject to relativity and time dilation: the crew will spend 5 years on board, but 33 years will pass on the Earth before they arrive at their destination. The ship accelerates during the first half of the journey and decelerates during the second. However, it flies through a nebula before the half-way point, damaging the deceleration module. Since the engines must be kept running to provide particle/radiation shielding, and because of the hard radiation produced by the engines, the crew can neither repair the decelerator nor turn off the accelerator.
The text consists of narrative prose interspersed with paragraphs in which Anderson explains the scientific basis of relativity, time dilation, the ship's mechanics and details of the cosmos outside.
As there is no hope of completing the original mission, the crew increase acceleration even more; they need to leave the Milky Way altogether in order to reach a region where the local gas density, and the concomitant radiation hazard, are low enough that they can repair the decelerator. The ship's ever-increasing velocity brings the time dilation to extreme levels and takes the crew further and further away from any possibility of contact with humanity. The initial plan is to locate and land on a suitable planet in another galaxy. Millions of years would have passed since their departure, and in any case they would be millions of light years from Earth. However, they find the vacuum of intergalactic space insufficient for safety; they must instead travel to a region between superclusters of galaxies to make repairs. They do, but the extremely thinly spread matter is then too dispersed to use for deceleration. They must wait, flying free but essentially without the ability to change course, until they randomly encounter enough galactic matter to try to decelerate enough to search for habitable planets. To make the waiting time shorter, they continue accelerating through the first several galaxies they encounter, more and more closely approaching the speed of light with tau decreasing closer and closer to zero.
The storyline is similar to that of the long poem and later opera Aniara, in which the ship was unable to stop and doomed to travel endlessly, but Tau Zero has a more upbeat ending (albeit one that does not conform to modern thinking on the evolution of the universe). By the time the ship is repaired, tau has decreased to less than a billionth and the crew experience "billion-year cycles which passed as moments". But by the time that they are ready to attempt to find a future home, they realize that the universe is approaching a big crunch. The universe collapses (a process the starship survives because there is still enough uncondensed hydrogen for maneuvering, outside the monobloc) and then explodes in a new big bang. The voyagers then decelerate, examining potential star systems. They eventually disembark at a planet with a habitat suitably similar to Earth, on which the vegetation has a vivid bluish-green color.