They are different meanings of the word last, and they have different grammatical requirements.
With a time period, last means "the most recent before now": last night, last week, last month, last decade, last century. (We don't say last day, as there is a separate word: yesterday. Shorter times, like last hour, are rare to non-existent: I believe I have met last hour in an old book, but not in current use).
These expressions are used adverbially, and do not take a preposition (such as on or at.
The more general meaning of last is "the final or most recent in a series"), and in that sense, it does not affect what preposition is used with its head noun.
We say on a day so we can say on the last day [of the holidays]. The bracketed expression can be omitted, but only when it is already established which period of days we are talking about.
Similarly in/during the last year [of my study]
We say at a moment, so we say at the last moment [of the game].
There is also an idiom at the last moment meaning "at the last possible time for something". But it is always in this form, never last moment.