It's been a frequent sight in the days since a Red Line derailment brought parts of the MBTA to a crawl: would-be public transit users on an MBTA platform searching for a lift from an on-demand ride service rather than waiting for the T.

But beginning Monday, Uber is giving its passengers the ability to flip the script and use its app to find either a ride or a way to get to their destination on mass transit, like the MBTA, the T's harbor ferries and Logan Express to the airport.

Uber users in Boston, Cambridge, Somerville and the surrounding area looking for a ride will soon be presented with a "transit" option, which will map out the best route to the destination via public transit, provide a real-time arrival estimate and guide the user on foot from the transit stop to their final destination. The app will also show users the price for the mass transit trip, which is often less expensive than paying for a ride in a car.

Boston is the second city in the United States in which Uber is rolling out its mass transit integration, after Denver, and the company said it is "part of Uber's vision of serving as a one-stop shop for transportation in the Boston Region."

"We are excited to give our riders in Boston a seamless way to access mass transit right from their app," Uber's head of transit David Reich said. "We know that Uber and the cities in which we operate share many of the same goals: reducing congestion, expanding access to transportation and tackling air pollution, and we look forward to continuing to partner with the MBTA and MassDOT to achieve those goals."

Danny Levy, chief customer officer at the MBTA, said the transit agency partnered with Uber on its integration "to provide this new convenience as a means to provide our customers with the most efficient transportation choices to make those whether with the T or Uber or both."