thank you for your post.
The reason you use "mich" in the first and "mir" in the second example is due to the different cases used in German. Please have a look at Grammar chapter 6.1-6.4 to find out more.
I will try to explain it here, but unfortunately I will have to use some Grammar terms. Here it goes:
The accusative (which is one of the cases used in German) is used for the direct object of a sentence. The direct object is the person, animal or thing that the action of the sentence is happening to. Here the example is :
Können Sie mich verstehen? = Can you understand me?
The action here is the "understanding" which is (hopefully) happening to the "me", because the "me" in this sentence wants to be understood.
The accusative uses "mich" when referring to "me".
Next we have
Können Sie mir helfen? = Can you help me?
Here we use the dative, which is used for the indirect obkect of the sentence. The indirect object is the person or thing to whom an action is being performed.
"mir" means "to/for me", so to make it more clear you could translate the sentence as:
Could you give help to me?
Does that answer your question? Please let me know if you need more examples. I know that the cases are not the easiest topic when it comes to German grammar.
When do you use mich and when mir