This is expected behaviour from the ancient 741.
From the datasheet:
As you can see, the output voltage cannot reach the supply voltages
The thing of it is, that it isn't proportional to the supply voltage. The output can never get closer to the voltage rails than 1 or 2 volts.
Since you are working with a supply voltage of 5V, you have very little room for the voltage to change. The output will probably vary between something like 2V and 3V. Not really all that useful.
There are many reasons not to use the 741. I won't repeat them here, but pretty much every reason not to use the 741 applies in your case.
You should use a rail to rail opamp, or, since you need to buy a part anyway, just go ahead and get a comparator rated to work on a single 5V power supply.
The LM393 is a comparator rated to operate on 5V. It is commonly available -it is nearly as common as the 741.