Spam, whether in the form of SMS or email, poses significant threats by compromising user privacy and potentially leading to unauthorized access to personal data. In the era of smartphones, where users store sensitive information, the risk of cyber-attack through spam messages is heightened. This research addresses the pressing issue of spam SMS and email detection using a dataset comprising 5574 messages from reputable sources. The collection includes contributions from the National University of Singapore SMS Corpus, Grumble text Website, Caroline Tag’s PhD Theses, and SMS Spam Corpus v.0.1 Big. With a meticulous approach encompassing data cleaning, balancing, preprocessing, and exploratory data analysis, the research employs the TF-IDF (Term Frequency and Inverse Document Frequency) vectorizer to enhance the model’s ability to capture the importance of individual words. This foundational work sets the stage for evaluating various machine learning models, including Support Vector Machine, Multinomial Naïve Bayes, Decision Tree, Logistic Regression, Random Forest, AdaBoost, K-Nearest Neighbors, XGBoost, Gradient Boost Classifier, Bagging Classifier, and Extra Tree Classifier. Notably, the Multinomial Naïve Bayes model emerges as a standout performer with 100% accuracy and 97% precision in phishing detection. The research introduces an intuitive user interface, facilitating real-time interactivity for model assessment and offering valuable insights for cybersecurity applications. The study contributes to the advancement of robust cybersecurity systems, emphasizing precision and accuracy in spam SMS and email text detection.