As others have mentioned, public transit beats uber/lyft when its actually the better, faster service (e.g. London, Tokyo).
But when public transit is poorly planned, slow, dirty, crime-ridden like it often is in the US, uber/lyft wins every time. Even when cities like San Francisco choose to spend billions on improving public transit, they mess it up every single time. There's a long list of hilariously short sighted decisions made on projects like the Transbay Terminal, The Central Subway, Geary/Van Ness BRT.
My daily commute literally runs along the t-line in San Francisco, but I never take it because it's basically the same speed as walking, slower than biking, slower than uber'ing. Poor planning and management is the cause of public transit's decline.