You are asking, if one had to choose between 2 mitzvos (levayas hames or nichum aveilim)and was only able to perform one of them, which one takes precedence. A shayla for a Rav.
It is 2 separate Mitzvos. You cannot do nichum at the levaya…… only after kevura
Levaya is a chessed for the departed. Nichum is primarily for the living. 2 Mitzvos, 2 purpose, 2 times. The question will be if I can go to a levaya to “a” or be menachem by “b”, which takes precedence? That answer will be the same if I am conflicted by which to participate in if only one family is involved.