Thomas Perez serves two very important functions. First, he is the moral opposite of Meursault. While Meursault is bothered, inconvenienced, and bored by his mother's funeral, Thomas Perez is emotionally affected. He shows us how one should behave given the circumstances. He punctuates Meursault's apathy and indifference. Secondly, Thomas Perez is a catalyst in terms of finding Meursault "guilty" of murder. After we observe Perez's disgust of Meursault, we begin to understand just how strange Meursault truly is.
Perhaps he is symbolic of human emotion and passion - which is what the existentialists seek to achieve in life.