Social media affects mental health in various ways, often leading to increased feelings of anxiety, depression, and loneliness due to constant comparison, cyberbullying, and the pressure to maintain a curated online persona, while also providing platforms for connection and support.