It depends on where/when you want that check to execute and what it should do.
You could, for example, show a list of similar named records on a form, where you would create a new record. In this case, you would show a list only if the form creates a new record (via form states) and show in this list records of the same relation, filtered by the name attribute (ILIKE for case insensitive comparisons).
This would result in a preview of similar named records, when someone tries to create a new record with an already taken name.