A common problem interpolating y-values that are not unique is how to make them appropriate for interpolation. One way is to simply choose a small range of data in the vicinity of the desired interpolation point.
x = [0,1,2,3,4,5,6,7,8];
y = [0,0,0,.25,.25,.25,.75,1,1];
idx = find(y <= 0.5, 1, 'last');
idxrng = [0 1]+idx;
Lxq = interp1(y(idxrng), x(idxrng), 0.5, 'linear');
Pxq = interp1(y(idxrng), x(idxrng), 0.5, 'spline');
plot(Lxq, 0.5, 'p')
Here the two interpolation menthods give the same result. That may not always be the situation, so specify an appropriate method.
Experiment to get different results.