UMD is a skill specific to bards and rogues. It allows them to use magic items which normally they couldn't normally due to not having the required pre-requisites (e.g. the ability to cast a spell or be of a particular race).
For your specific example, the pre-requisite to be able to use a wand is to have the same spell as part of your class spell list. In addition you need to know the command word. The paladin in your example could use the wand automatically assuming he knew the command word (an identify spell would reveal this) as he has CMW in his class list. Note it makes no difference if he is too low level to cast CMW himself just yet, he only needs to have levels in class that has it.
The rogue could also potentially use the wand, but as he does not have a spell list, let alone one that contains cure moderate woulnds, he would have to rely on UMD skill. If he knew the command word he could activiate it by making a roll DC20. If he didn't he could still try, but the target number would be higher and there would be a risk of a malfunction if he got it wrong. Read the skill description carefully for how this works, sometimes the character needs to make more than one roll to activate an item as he may be short more than one pre-req.
Final note, if a rogue or bard finds a magic item that anyone can use (e.g. a ring of protection or potion of cure serious wounds) then he does not have to make a skill roll. UMD is only used to activate items they normally couldn't.