Ah, well there's your first problem.
You shouldn't store multiple values in a single field. Normalize your DB schema to at least the first normal form (which eliminates all multi-valued columns) by creating a separate "friends" table that likely contains only two columns; user_id and friend_id. Both are foreign keys back to your users table.
So for example, if my user ID was 100 and I wanted to friend the users whose ID's are 2, 5, 3, and 10, then you would see four tuples in this new "friends" relation: (100, 2), (100, 5), (100, 3), and (100, 10).
Not only does this follow basic SQL normalization practices, but it also makes the data much easier to work with (hence why this is a basic practice to begin with 😉).