In San Francisco, the story goes that before the ride-sharing days, if you lived in Potrero Hill or in the Richmond, Taxi Drivers would refuse to pick you up even if you called their dispatch center (they would just no-show). So the end result was that people who lived in those districts were not served equally.
Yes it's technically illegal, no there is no one enforcing that.
Uber/Lyft come along and create an incentive structure where the driver can't discriminate even if they want to, and everybody wins.
There are real benefits to what ride-sharing companies have been able to accomplish.