Médecin is the profession. When you go to the doctor, you are visiting the medical professional, the médecin.
Docteur is a title. It applies to those with advanced degrees and well as those with medical degrees. Docteur Jean-Martin Charcot, for example.
Typically when the French refer to their medical doctors, they use the word médecin. Or more colloquially, "blouses blanches" (white coats).