Every CMS option offers tools for validating input. The best way to ensure you don't receive invalid content on the frontend is to prevent it being entered in the backend.

Contentful has a list of available validations. Any field can be marked as required, but which additional validations are available largely depends on the type of content. For example, a date field can be limited to a specific range of dates.

Validating Content in Contentful

In Sanity, the validations are added as code within the schema file. The benefit of this is that it allows for very customizable, fine-grained validations. However, regardless of which headless CMS option you choose (and there are many), ensure that you do whatever it permits to prevent erroneous data making it to the front end.