Parts of speech are a matter of theory. Different people have different theories, and as a result, they classify words in different ways.
The goal of a theory is usually to describe the behavior we see as simply as possible. Instead of describing each word on its own, we start out by lumping words together when we can describe them the same way. But there are always a few exceptions which don't fit cleanly into our categories, and we need to describe them separately. Either we describe an exception on its own, or we pick the closest category and come up with a list of ways it differs from the usual members of that category.
In this case, the simplest answer is probably to say that it's a preposition. It passes all the usual tests for a preposition. But near has a couple features very few prepositions do: it inflects! It has comparative and superlative forms, nearer and nearest. That's quite unusual! And it can be modified by adverbs (as in very near the window or much nearer the window). That's unusual, too! Here's what Quirk et al. (1985, p.663) have to say:
The simple preposition near and the complex prepositions near to and close to (all locative; cf 9.20) satisfy all three criteria for prepositions. At the same time, they have certain affinities with adjectives and adverbs. Near (to) and close to are the only prepositions which have both comparison and intensification[.] (emphasis added)
But this is certainly not the only possible answer. You can argue for classifying it other ways. The fact is, it's different from other prepositions. But it doesn't fit into any other category cleanly either. So what should we do?
The most important thing isn't what part of speech it is. Rather, the most important thing is that you understand how it's used. In this case, you can use a category like "preposition" as a starting point, and then describe how it differs from the central members of that category. So when I call near "a preposition with comparative and superlative forms that can be modified by adverbs", I'm trying my best to keep the description as simple as possible. That's all.
I suggest you come up with whatever description makes the most sense to you and use that.