string[] customerNames = searchModel.CustomerName.Split(',');
query = query.Where(d => customerNames.Any(c => c.Contains(d.CustomerName)) || customerNames.Any(c => c.Contains(d.Company1.CompanyName)));
But you should be aware, that it may get really slow when customerNames
has a lot of items.