We use the to talk about something the speaker and listener both know about.
•I need to see the doctor.
Meaning: the speaker and listener both know which doctor.
•I need to see a doctor.
Meaning: the speaker is talking about any doctor, not a specific doctor.