I take it you don't have 3D info on all components, and thus can't simply eyeball the one that stands tallest?
Could probably do a query by Component Height and see where the cutoffs are (>1mm, >2mm, etc...). Don't think there's a way to query the one tallest component; that would require an N x N comparison (or at least O(N lg N)), while Query is only applied to all N objects once. For each side, just add "AND OnBottom" or whatever and do it again.
IMX6 is going to have a standard maximum profile, no? So you could also specify component height design rules. Probably one rule for OnTop, another for OnBottom, since they're probably different?
Tim