How to make a DC motor act as some sort of switch

No I’m suggesting you dump the motor and drive a relay with an Arduino output . Use the relay contacts to switch your load .