For a DC motor, they are rarely connected directly to the microcontroller. But you can put a diode across the motor terminals to minimise any back EMF.
A stepper would typically have a driver circuit between the microcontroller and the motor.
A small servo would usually just need one signal connection to the microcontroller, there's no back EMF via that path. You would of course also need common ground.
For a DC motor, they are rarely connected directly to the microcontroller. But you can put a diode across the motor terminals to minimise any back EMF.
A stepper would typically have a driver circuit between the microcontroller and the motor.
A small servo would usually just need one signal connection to the microcontroller, there's no back EMF via that path. You would of course also need common ground.