a linear optical encoder with some black/wite stripes on a paper and a light barrier
If you used four channels, with 0000/1111 reserved for "completely outside", you'd have 15 positions for 300 mm, or 20mm per position. If you used US Letter printable sticker paper, with about 10mm margins, you have 260mm of printable length, so 18mm per position, or about ±9mm accuracy.
Perhaps you could use a common sample/latch signal, and each set of IR/optical sensors tied to a shift register, so you'd simply trigger the common sample/latch to latche all optical sensors, then shift them one bit at a time? You'd need just three data lines (two outputs: sample/latch, and clock; and one input, data), one latching parallel to serial shift register and up to eight optical sensors per drawer. Maybe 74HC165 series? The optical sensors seem to be the most expensive part. Might have to do your own using a LED and fototransistors?
If you do the drawers in pairs, with 15 positions (with 0000 or 1111 reserved for "out", depending on which pattern you get when there is no strip detected at all), you could use a single 8-bit shift register per pair of drawers, and halve the number of cycles needed to shift all the bits to the microcontroller.
At 500 kHz clock rate (I have no idea whether that is realistic!) you could then read 62500 drawers per second. Something like a Teensy 3.2 which has 64k of RAM, could remember the positions of each drawer, and only provide the changes to the consumer (and all states if requested, or at specific intervals, like once every few seconds).
This would be what I'd try, with no guarantees of it working.