Op amp output limited
You can't run a 741 on a 5 V supply.
That op-amp design is &gt; 50 years old and was designed for ±12 to 18 V supplies. The output can't swing within about 2 V of either supply rail so you should expect to see the output vary between about 2 V and 3 V. You seem to be getting a little higher.

Figure 1. Internals of the ancient 741 opamp. Source: Wikipedia.
Q14 pulls the output towards V+ but there is a drop of a volt or two across it so it can't get you to V+. Similarly Q20 pulls the output to zero when required but has a minimum of couple of volts drop across it. That didn't matter for analog circuits with a ±12 V supply as there was still plenty of swing room. With a 5 V supply you have almost none.
Buy a modern op-amp with rail-to-rail inputs and outputs.