Memantine is a medication primarily used to treat moderate to severe Alzheimer's disease by acting as an N-methyl-D-aspartate (NMDA) receptor antagonist. By blocking the effects of excess glutamate, which can lead to neurotoxicity and cognitive decline, memantine helps improve memory, attention, and overall cognitive function in patients with dementia.