Uber drivers want to make more money. Uber wants to be profitable. It turns out the two may not be reconcilable. The cancellation behavior you noticed is a direct result of this. The way it works is that Uber is trying to force drivers to accept rides if they’re available. There are many rides drivers do not want, usually because they can’t actually be delivered profitably at Uber’s published price. What the drivers really want are the premium rides, but Uber will send them plenty of chaff to go along with that wheat. So the drivers game the system and cancel after accepting.
There are scenarios where this is highly predictable. Airports at rush hour will inevitably get this behavior in most places I fly. (Note: I only use Uber internationally, domestically I use Lyft. I do not know how Uber works within the US anymore.)
The solution, if you want to use it, is to pay for the up-market rides. You magically will suddenly stop being canceled. Then Uber goes back to being the way it used to work (the drivers are also more pleasant when they’re actually making money to shuffle you from point A to point B). Or you can do what I’ve taken to doing now that I’m traveling again, and try public transit. Since I mostly travel to major European cities these days, this is usually quite reasonable, and often faster than a car anyway.