gear motor can be used as generator
No.  Most worm drive mechanisms cannot be backdriven.

If that were not in the way, a brushed DC motor does typically function as a "lecture demo" generator when backdriven, perhaps to light an incandescent bulb, but harnessing one for useful purposes involves factors not detailed in your question.