1. An apparatus comprising: a shape defining element; an aiming lens arrangement; an aiming light source configured to emit visible light through both the shape defining element and the aiming lens arrangement to generate an aiming pattern on a target object, wherein a shape of the aiming pattern changes with a distance characterizing a separation between the target object and the apparatus at least between a first distance and a second distance, and wherein the aiming pattern at the first distance and the aiming pattern at the second distance have substantially different geometric shapes that are not similar to each other and are not congruent under any uniform scaling transformation; an illumination source operative to generate an illumination light emitted towards a barcode on the target object; an imaging lens arrangement; an imaging sensor having photosensitive elements for detecting light from the target object through the imaging lens arrangement to create first pixel data during a first time period when the aiming pattern is projected on the target object, and for detecting light from the barcode through the imaging lens arrangement to create second pixel data during a second time period when the barcode is illuminated by the illumination light; and a controller configured to process the first pixel data for determining the distance characterizing the separation between the target object and the apparatus, wherein said determining the distance comprises comparing the shape of the aiming pattern in the first pixel data with an expected shape of aiming patterns at multiple distances.