Get Date of custom field and use conditional logic

OK, so you’ve got a couple of ways to go about this, but first, you need to decide how urgently you want to inform the user that their value is invalid: immediately, or when the post is saved? A general rule of thumb would suggest that earlier is better, but given that you seem to suggest that you’re new to custom coding, you may be forced to go later (it might be easier if you want to stick with WordPress-specific coding). Here’s the rundown in any case:

Immediate Validation

This can be done with Javascript/jQuery. Write some code that listens to each of the input’s change events, then check if there’s already a value in the other input. If so, run your validation logic, if not, wait.

Important note: this solution basically avoids WordPress development all together. Not necessarily a bad thing, but worth noting.

Late Validation (on post save)

If you’re happy to wait until the post is saved to perform validation, you can hook an action to run your validation code. If you’re using Advanced Custom Fields, you can use the ‘acf/validate_save_post’ hook (ref: https://www.advancedcustomfields.com/resources/acf-validate_save_post/). If not, just use the core ‘save_post’ hook.

Alternate Immediate Validation (untested)

If you’re using ACF, it looks like you can use a field-specific hook, like ‘acf/validate_value/name=your_date_field_name’ (ref: https://www.advancedcustomfields.com/resources/acf-validate_value/). Not around the event life-cycle of ACF well enough to know what’s possible with this, so you’ll need to look into it, but when the first field’s validation event fires, you could store it’s value (if you’re developing a plugin, a static property would be best, if not, just a global variable) to check on when the second field’s validation event fires.