Explanation
Several words are sometimes used as adverbs or sometimes used as prepositions.
A word is a preposition when it governs a noun or a pronoun, It is an adverb when it does not.
He moved on. “On” is an adverb here
Keep your books on the table. “On” is a preposition here