In a very broad sense, there are two types of life insurance:
permanent life insurance and
term life insurance.
Permanent life insurance is a type of life insurance that can stay in force for your entire life, as long as you pay your premiums in full. Permanent life insurance usually, but not always, builds cash value for you that you can use for expenses later in life.
On the other hand, term life insurance is only in force for a specified amount of time: usually 10, 15, 20 or 30 years. At the end of the term, your coverage expires and you will need to either convert your policy to a permanent life insurance plan (if available) or purchase a new policy for a new term. The advantage of term life insurance is that it's somewhat less expensive than permanent life insurance.
The answer depends on what you’re trying to accomplish by having a life insurance policy. Are you insuring your life so that when you pass away your children will be able to go to college and your spouse will be able to pay off the mortgage? These are temporary concerns and so a temporary form of life insurance - term life - is best suited to address them.
However, if you are concerned about providing income to a widow or widower for life, funding retirement, or passing wealth to a future generation then you will find that permanent life insurance is better suited to address these goals.
Always ask yourself why you need your life insurance policy. If it’s for a temporary goal, then term insurance is probably best. If it’s to address a long-term need or concern, then it’s time to start looking at permanent policies.