Due, desert, merit are comparable when they mean what is justly owed to a person (sometimes a thing), especially as a recompense or compensation.
Due usually implies a legal or moral right on the part of the person or thing that makes the claim or is in a position to make the claim and suggests a determination of what is owed by strict justice. (see also Due vs Rightful vs Condign and Due for vs Due to )
Desert (often in plural deserts) suggests not a legal right but a moral right based upon what one actually deserves, whether it be a reward or a penalty. (see also Abandon vs Desert vs Forsake and Desert vs Dessert )
Merit is a somewhat complex term, often shifting in its major implication but (see also EXCELLENCE) commonly implying a deserving either of reward or punishment on the ground of what has been accomplished or of commendation, esteem, or acceptance on the ground of intrinsic and usually excellent qualities. (see also Excellence vs Merit vs Virtue vs Perfection and Deserve vs Merit vs Earn vs Rate )