That is price discrimination, not dynamic pricing. Price discrimination involves charging more or less based on the buyer’s perceived willingness and ability to pay. Dynamic pricing is based on fluctuations in consumer demand. A taxi ride at midnight is not the same as a taxi ride at noon; if there are proportionally fewer drivers available at midnight, fares will be higher at midnight.
The same principle may be applied in the restaurant industry; kitchen throughput has limits. If these limits are reached during peak hours, the restaurant can either raise prices during these hours or reduce prices outside of these hours to spread out the consumer demand, maximizing earnings during peak times while reducing kitchen idle time during off-peak hours.
Still, wildly volatile pricing is also an excellent reason to avoid taxi apps. Why politicians have no desire to rein them in is baffling. I guess the stock market is really all that matters at the end of the day....
Dynamic pricing could technically fall into the category of price discrimination if the discrimination is temporal (e.g. people who need a taxi at 8:00 AM pay more than people who need a taxi at 8:00 PM), but generally price discrimination refers to changes in price based upon anticipated demand, whereas dynamic pricing refers to changes in price based on actual demand.