so something like elems.Where(x => ids.Any(id => x.ID.Contains(id)))
What this is doing is going through each item in elems (your html element list) and then going through each id in your id collection and if any match, then it will return that element.