If one violated the prohibition of Borer B’Mezid (intentionally), the selected food is forbidden to benefit from. The only solution is to mix it back in with the P’solet (waste) and start again by selecting in a permitted fashion.
If one violated Borer B’Shogeg (unintentionally), Hacham Ovadia and Hacham David in Halacha Berura bring several factors to rely upon to be lenient. First, there is the opinion of Rabbi Meir who permits benefiting from all prohibited Melachot performed B’Shogeg. Second, it is only forbidden to benefit from Melachot similar to Bishul (cooking) in which there is an intrinsic change to the object. E.g. raw food becomes cooked food. However, Borer, is similar to the Melacha of Hosa’ah (carrying) in which the food is moved about, but nothing is done to the food. In such cases, the Hayeh Adam (Rav Abraham Danzig of Vilna, 1748-1820) rules that there is no problem benefitting from the Melacha.
Moreover, there was a permitted way to perform the Borer, and therefore it is not actually considered benefiting from a prohibited Melacha, since he could have done it the permitted way.
If one violated Borer unintentionally he may benefit from the food on Shabbat.