I have a question about instagram a social media platform which I have benefited from with knowledge but the thing is the social media algorithm shows me pictures of girls and these girls are everywhere to the extent I have to lower my gaze every other post sometimes. I want to know if this is diminishing my ability to gain higher spiritually or am I over thinking this i feel social media is haram?

There is no problem in looking at social media and benefitting from its good content. However, if the presence of certain inappropriate content is causing you to sin or deviate from religion then it must be avoided.