Near is mostly about closeness in space or time, as in the bus stop is near the pharmacy, while nearly means almost or not quite, as in she nearly missed her flight. A quick check: if you mean "almost" rather than "close by", reach for nearly.
The core difference
Near points to physical or temporal closeness, while nearly means almost, short of completion.
- near — adjective/preposition, close in distance or time: They live near the coast.
- nearly — adverb, almost: It's nearly midnight.
- near — can also mean almost as an adverb: The tank is near empty.
How to tell them apart
Near does double duty: it is an adjective and preposition for closeness (near the exit, near the coast), but it can also work as an adverb meaning almost, as in the tank is near empty. Nearly is the more common adverb for almost, and it fits smoothly before verbs and adjectives, as in she nearly missed her flight or it's nearly finished.
The confusion tends to surface with time and quantity: near the end of the project describes proximity to a point, while nearly finished describes how close something is to completion. If in doubt, nearly is the safer choice when you mean almost.