Very generally speaking, a direct object completes or specifies the meaning of the verb, while an indirect object adds a destination, a goal, someone or something towards which the action is oriented. In technical terms, an indirect object is often a recipient or a beneficiary of the action.
For the most part, if a verb has only one object, it is a direct object. Some verbs, however, only take an indirect object. You have to learn that together with the verb, just like you have to learn the gender of a noun along with the noun itself. But using the general idea of the functions of objects that I have described, you can often guess.
In this case servir (which here means "to be of use") takes only an indirect object because the object is a beneficiary, i.e. it is someone that gets an advantage from the action. Beneficiaries are often introduced by the prepositions "for" or "to" in English. In Spanish, they are often indirect objects (although they can also be introduced by prepositions, like para). You say in English that something "is of use to someone"; in Spanish you say "le sirve (a alguien)". I chose to translate servir as "to be of use" in order to show you how you can find the same idea and a parallel structure in English and in Spanish. You can't always do this, regrettably, which is why it's better if you learn the verb in context. Instead of memorizing the verb and its meaning, try to memorize short sentences which show how it works.