LM2596 output and input
The potentiometer sets the output voltage.  It is measured against a fixed reference generated inside the LM2596 IC.

The output voltage should not change when you change the input voltage 



There are limits, of course.

If you put 379Vdc on the input, then your "output" will most likely be a "bang" and a "RUD"  (rapid unscheduled disassembly.)

If the input voltage is too low, then the output won't be at its set voltage, either.

The output voltage in most buck regulators needs to be a little higher than the output.  I can't find a minimum difference in the datasheet, but all of the charts show at least 1V between input and output voltage (as far as I can see from the drawings.)

Its absolute maximum input is given as 40V.

So, if your input stays between about 6V and 40V, then your output will stay at the 5V level you set.