Linear pot is not quite linear

The way pots are made means thay can not be precisely linear at the ends. Your best solution is to mechanically restrict the range of movement (say 5% to 95%) and adapt your program for thos evalues..
If you want a precise measurement of position you need to use a purpose made position sensor - eg a rotary encoder.