مَرَرْتُ بِهِ.
Meaning: I passed by him.
Parsing: marartu is a verb with subject; bi- is a preposition; -hi is the pronoun in the genitive position; the prepositional phrase relates to the verb.
سَلَّمْتُ عَلَيْهِمْ.
ʿalā is a preposition; -him is its attached pronoun in the genitive position; the phrase relates to sallamtu.