Market order
An instruction to buy or sell straight away at the best price currently available. It puts certainty of execution ahead of certainty of price.
A market order says fill this now, at whatever the order book is showing. A buy takes the lowest asking price on offer, a sell hits the highest bid on offer, and in a busy market that is the end of it: the order is done in about a second, at or very near the price on the screen. Certainty that the trade happens is the whole point of it.
What it does not give you is a price. The gap between the price you expected and the price you got is called slippage, and it has two sources. Liquidity at the best quote is finite, so a large order clears that quote and fills the rest at worse prices, deeper into the book. Separately, the quote itself keeps moving between the moment you press the button and the moment the order arrives. Both effects are small in a heavily traded share in the middle of the session and can be severe outside those conditions.
The mistake is assuming the last traded price is the price you will pay. It is a record of a trade that already happened, not an offer being made to you. Orders sent before the opening auction, in thinly traded shares, or during a fast-moving session can fill a long way from it, and any market order in a stock with a wide bid-ask spread crosses that entire spread by design. A limit order is the instrument that refuses to.