You could add a event receiver(item adding) at your custom list.
My test code for your reference:
public override void ItemAdding(SPItemEventProperties properties)
{
base.ItemAdding(properties);
object peopleColumn = properties.AfterProperties["SingleUserColumn"];
SPWeb web = properties.Web;
SPFieldUserValueCollection objUserFieldValueCol = new SPFieldUserValueCollection(web, properties.AfterProperties["MutipleUserColumn"].ToString());
for (int i = 0; i < objUserFieldValueCol.Count; i++)
{
SPFieldUserValue singlevalue = objUserFieldValueCol[i];
if (singlevalue.ToString().Equals(peopleColumn.ToString()))
{
properties.Cancel = true;
properties.ErrorMessage = "Contain two same user";
properties.Status = SPEventReceiverStatus.CancelWithError;
}
}
}
Demo on how to create event receiver for your reference:
https://www.c-sharpcorner.com/article/steps-to-create-item-event-receivers-in-sharepoint-2013-using-c-sharp-server-object-m/
If the response is helpful, please click "Accept Answer" and upvote it.