Short answer, yes.
Not only should you get an inspection completed before purchasing a new home but you should get several.
A home inspection will not necessary identify everything that may be an issue with a home but should identify red flags.
More than one Home Inspection
Most people will order a general home inspection for a few hundred dollars and get back a general report to review. However, it may be a good idea to bring in a few specialist.
HVAC - inspections will tell you how your home’s heating and cooling systems are functioning, and if any repairs are needed
ELECTRICAL - inspect the electrical installation and its components. Make sure that the home is up to date and safety standards. Check of receptacles, wiring, electrical service panels, etc.
PLUMBING - Check existing condition of main sewer, water heater, toilets, etc. Many times you will not know of an existing plumbing issue until you are living in your home. At which time it becomes your responsibility
GENERAL CONTRACTOR - General contractors are more qualified than home inspectors. They can contract issues that they note for repair. Especially, necessary if thinking of any additions, home repairs, home improvements.
Sometimes the cost for these can be added to your cost at closing so you do not have to pay upfront. Either way look at it as an investment. If there are issues or repairs needed that can be identified during the contract period you may be able to get the seller to pay for them. Or negotiate a seller concession on the purchase contract.