I'm not sure exactly what it is that you are asking.
They all can be adjectives or adverbs. First and last also have noun meanings. Last may also be a verb. Only may also be a conjunction or a preposition. Nextmay also be a preposition. But with the word the, the usages must be either adjectival or nominal.