How do I iterate over a large Texture2d quickly?

I have a large Texture2d image (5632 x 2048) that I need to iterate through and split into colours, but given that there are over 11 million pixels, doing this through a traditional foreach loop is taking over half an hour. Is there a better approach I can take?

The issue wasn’t the fact that I was iterating over a large list, it was that I was calling List.Contains() for every single loop on a growing second list. According to this StackOverflow question, Contains on a List is quite slow, and I instead used a HashSet, which shortened the entire iteration to a few seconds.