Changing GPIO pin configuration on the fly
Mixing an analog function of a pin with a digital function is a bad thing to do.  It is bad enough that a pin of one type is next to another one. Experienced engineers spend a lot of effort on design and layout to get digital coupling and noise away from analog signals.

I suggest that you work to find two digital functions that you can time share on a pin.