In the case of burying a man, it is preferable to give priority to whoever is given priority in washing him if possible. The Prophet (peace be upon him) was buried by
Usamah who were exactly the same people who washed him (peace be upon him) and because that is more likely to conceal the dead person's conditions. (Part No. 7; Page No. 337)
`Aly, (may Allah be pleased with him) said: "One's own family is worthier of burying him."
In the case of burying a woman, priority should be given to her male Mahrams (unmarriageable relatives) and her husband if possible, because the woman's body is a `Awrah (parts of the body that must be covered in public) and going down into the grave and burying her, necessitates touching her body from over the shroud. However, there is nothing wrong in allowing others to do that.