The function of the word near in the sentence is a preposition
3. preposition
Explanation:
A word that shows the relationship between a noun or pronoun and another word in the sentence is called preposition. A prepositional phrase begins with a preposition and ends with a noun or pronoun, called the object of the preposition.
General examples of time prepositions include: in, of, to, at, by, for, with, under, above, into, onto, upon, about, behind, beside, before, after, towards, inside, outside, below, around, etc...
Also preposition can never be followed by a verb. Some types of prepositions are:
1) Simple Preposition
2) Compound Prepositions
3) Phrase prepositions