At the time when you are introducing yourself to the family at a funeral service or memorial service, be proactive. Those grieving will likely not approach you, so you should be the one to take the first step.
It's a good idea to keep your words brief. Say your name, specify your personal and/or professional relationship to the person who died, and express your condolences. If certain members of the family want to talk more along, be prepared to stay and chat. You can share a memory of the person who died or simply inform the family how much the person who passed away will be missed now that he is no longer with us.
It is also good practice to introduce yourself to other guests present at the service. You can ask about how precisely they may be linked to the person who died or the family, or else you can introduce yourself and describe your connection to anyone who died or the family. Remember that everyone attending the service is there to grieve and console together, and you ought to not feel embarrassed about being unsure of anyone or introducing yourself to anyone at all.