Settlement is not simply the last trade. Exchanges use a defined procedure — typically a volume-weighted average of trades in a closing window, with rules for illiquid deferred months derived from spread markets.
It matters because it drives daily-settlement cash flows, margin requirements, option exercise decisions and the fair value of index products. It is also the number some traders have tried to manipulate; see banging-the-close.
Example: CME settles ES on the volume-weighted average price of trades between 15:59:30 and 16:00:00 Eastern. A 3:59:58 print at an outlier price barely moves it.
Related: daily-settlement, trade-at-settlement, final-settlement, mark-to-market