Venues treat a price change, and usually a size increase, as a new order at the back of the queue. Reducing quantity often preserves priority. The details vary by venue and are worth knowing if you trade passively.
There is also a race. Between sending the cancel and receiving confirmation, the original order can still fill — so you may end up filled on the old order and then filled again on the replacement.
Example: you are 1,500 shares deep in a queue at 40.00 and amend to 40.00 for a larger size. You now sit behind 18,000 shares instead of 1,500. Worse, a fast seller trades your original 500 shares in the same millisecond your cancel is in flight, and the replacement then fills too — 1,000 shares when you wanted 800.
Related: queue-position, working-order, client-order-id, self-trade-prevention