hi Karthiha
custom Expressions will be trigger on Page refresh as well. so if you have any onchange on any of the other fields this will be triggered.
also its not an easy task to add such a custom validation.
Adding NanoFlow or Microflow validation is always preferred. Since its just 1 Field validation Performance is not delayed by adding this.