The meaning is pretty much the same, but "it doesn't matter" can stand alone as a sentence. In your first example, both are complete sentences; however, the second should use a semicolon rather than a comma to connect the two independent clauses.
- No matter who you are, you should respect your teacher.
- It doesn't matter who you are; you should respect your teacher.
- No matter if you are short or tall. ー this is not a complete sentence as there is no verb.
- It doesn't matter if you are short or tall. ー this is fine as is.
I hope that explanation helps. Good luck with your studies.