"I'm sorry" can be used in a funeral to express your condolences, but "I apologize" can not. If you say "I apologize" in a funeral, it means you are not expressing condolences, but rather, you are expressing remorse for killing them. That is why OP chose this template.