I'm using QGIS3.16.13 and when I add the scale-bar from "view > Decorations > Scalebar" to my map I noticed that it shows the wrong distance. I'm not talking about the print-composer, just the usual QGIS-interface. The scalebar is less than half of what I measure:
I know for a fact that this measurement must be correct (and the scale-bar must be off) as I know my raster's pixel-size is 0.5 m. So when I zoom in, on a single pixel an re-measure, the miss-alignment maintains roughly the same ratio: the scale-bar is circa half of what I measure:
I found this question on a similar issue (but almost 10 years old). However, in contrast to the issue there, I use the same coordinate system & projection for my project, my raster-files and my shapefiles are all in (EPSG:32739 - WGS 84 / UTM zone 39S - Projected).