Aspirin primarily functions by inhibiting cyclooxygenase (COX) enzymes, which play a key role in the synthesis of prostaglandins. Prostaglandins are lipid compounds that contribute to inflammation, pain, and fever, common symptoms in many infectious diseases. By inhibiting these enzymes, aspirin can help reduce these symptoms.