Work is not a stative verb.

Furthermore I wouldn’t find the the two sentences synonymous. While both express you worked as a doctor, the latter seems to be emphasizing you only occasionally worked as a doctor. Or depending on context it would be confused with the unreal future.

As a side note it is “use to” not “used to” in that context.