Cheap, reliable, low resolution, linear position sensor
You could also use a capacitive sensor. Have a floating contact that travels over long thin conductive triangle. At one end there would be hardly any capacitance and at the other the surface area would be maximized increasing capacitance.