When you purchase your life insurance policy you choose who will receive the death benefit when you die. You may choose one or more people to receive the life insurance proceeds upon your death.
The beneficiary who receives the money from your life insurance can use the money for any purpose they choose.
So, yes, the life insurance can be used to pay off debt, pay for your funeral, provide money for your family to maintain their lifestyle, pay off the home mortgage loan, provide for your spouse's retirement, provide for your child's college education, etc.
The beneficiary gets to choose what he or she uses your life insurance for and how it is used.
However, if you are married perhaps you explain to your spouse how you would like the life insurance used before you pass away.