More than €17m was provided in emergency payments over the past two years to people struggling with the cost of burying loved ones.