I keep playing with someone who always leave in the middle of the game on my team. I did block this guy/woman, yet I still somehow play in the same team as him/her on the match. So what is block for?

The Block feature is to prevent communication from an individual. This should prevent you from seeing their text chat and from hearing their voice chat.

Block also nullifies the "Prefer" feature if that player has you preferred.

Unfortunately, Block does not control whether or not you might end up in a game with that person.

To further expand on Jeff Kaplan's explanation, the Block Function works across the entire BattleNet player network. Learn more about the Block function in this support article (click here).