Avoid Short when using different Plugs

so if you get a TS jack you know it's a switch and if you get a TRS jack you know it's a potentiometer

Connect them as you would for a switch with a pullup resistor (builtin) for the TS and as you described a potentiometer would be wired with the wiper to A0 and 5v and GND on the two other ends.

or are you saying you are getting sometimes a TRS jack but it's not a potentiometer but a switch ?