Who is used for persons only.
Which is used for animals and inanimate objects.
That can refer to both persons and things. It is not used in non-identifying relative clauses.
That is preferred in the following cases:
After adjectives in the superlative degree
- He is the most versatile writer that I have ever read. (More natural than ‘He is the most versatile writer who I have ever read.)
After the words all, same, any, none, nothing and only
- Take all that you want. (NOT Take all which you want.)
- He is the same man that he has been.
After the interrogative pronouns who and what
- Who is it that troubles you so much? (NOT Who is it who troubles you so much.)