You need to establish the issue, whether it's the counter that's not perfectly flat, OR level OR whether the cases are just slightly different lengths.
If you turn them upside down resting on their tops, do the edges line up evenly across?
Can you run a straight edge across the countertop without gaps?
Is the counter top perfectly level across?
If you are trying to make/hang them plumb, on a surface that's not level, you'll have this issue.
iF they are slightly different lengths OR not cut perfectly square across the bottom, front to back you'll have issues.
One way is to screw them together into one continuous unit and deal with that rather than individually. I would use shims to level them out rather than a filler. Thin plastic from those high interest credit cards will work. Medical tongue depressers may work, but are not totally waterproof like the plastic.
You can apply glue, them slip them underneath, let the glue set and finally trim them off with a sharp knife.