Dying words are a very special form of quotation. Some are rehearsed and contrived; others are spontaneous and witty.
‘Famous last words‘ are often impromptu sayings, spoken by the dying person for the first (and, of course, last) time on their deathbed.