The inverting input is 3.9V, no matter how much the non-inverting input is, the output is 0,; when the inverting input is 3.5, the output is 5V, is the common mode voltage input too large?
Introduction to LM393 comparator: https://www.utmel.com/components/lm393n-comparators-ic-application-pinout-and-datasheet?id=109