Chop the tomatoes and onions and saute them/it?
Should it be "them" or "it"? because I have heard that them is used only for people.
The third-person (that is, neither the speaker nor the person spoken to, but some “third” person) singular pronoun is, unusually for English, broken up into three forms based on the gender of whatever the pronoun refers to. These are he/him/his (masculine), she/her (feminine), and it/its (neuter, explicitly inanimate or at the least non-person).1 It should never be used to refer to a human being (or, put another way, doing so is extremely insulting).2
The plural, however, goes back to the English norm of not caring (grammatically) about gender at all, and uses they/them as the plural for all three of he/him, she/her, and it. Using them as the plural of something that would be it in the singular is perfectly fine.
For completeness’s sake, so long as I’m going to the trouble to include footnotes and caveats: there are currently a variety of suggestions for expanding the list of third-person singular pronouns, for example to include a neutral pronoun (i.e. not neuter, which is explicitly inanimate, but a pronoun that can refer to a person without specifying whether that person is male or female). The only one of these that seems to have any traction at all is the use of they/them in the singular for this purpose, but this is still not considered acceptable in formal English (and formal style guides instead recommend constructions like “he or she”).
Except when it’s not, since this is English we’re talking about and everything, even this, has exceptions. For examples, babies of unknown sex are sometimes referred to as it without insult given, and when asking who an unknown person is, we use “Who is it?” even though it is expected to be a person. Unfortunately, it would be very difficult to attempt to list all of the exceptions, or try to give any solid guidance when it is or is not OK. To do so would be beyond the scope of this question.
Them not only stands for people, it also stands for things since it's the general plural for it.
It works like this:
— Can I eat those apples?
— Yes, eat them all.