How to apply some rules to fields in native contact form?
If your real case is the telephone example, you need to enable the Telephone module that comes with Drupal 8 Core. Then add the telephone field to your contact form in "Manage Fields".

If you think you're doing something "popular" chances are high that someone already did it (ie Telephone module), so don't rebuild the wheel.

If your scenario is some special use case, then you want to do a custom form validation for your form field. See How do I add a custom validation to an existing form/field?