Dividing by 1023 or 1024? The final verdict on analogRead

Give the ADC 5V and it cannot measure all the way to 5V.

In some people's heads the world is perfect and only one answer can right.

In the real world I can read the same signal with the same ADC several times and average the yes-they-are different values to arrive at a closer to real value than one read is likely to give. It's called oversampling and it works because the real world is not as diagram-simple as people's notions.

The truest you can get on a single read is "center of the bucket" and to realize that and this has been noted here since YEARS ago that the error margin is more than a "bucket" wide.

In the real world we build to tolerances. That's what the band on the resistors is there to tell you. That's what tolerances in specs are there for. The measure and the cut are never perfect, only ever within acceptable range (what will be tolerated by the design, hence the term "tolerance") that since you CAN'T measure perfectly, you CAN'T tell if anything happens to be so.

In the real world, when someone takes a procedural convenience that is within tolerance, you have to get UNREAL to object.