A pot, when read with analogRead(), gives you a number that relates to the position of the wiper. The ping sensor gives you a number that relates to the distance to an object in it's range. Once you have that number, where it came from isn't important.