It's an awful case, especially if you inherit some DB with such a scheme, but to find friends you can use:
SELECT friend.*
FROM user u
left join user friend on concat('|', o.friends, '|') like concat('%|', friend.id, '|%')
where u.id = 5;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…