The exponential growth of user-generated content on social media platforms, online news outlets, and digital communication has necessitated the development of automated tools for analyzing opinions and attitudes expressed in text. Stance detection, a critical task in Natural Language Processing (NLP), aims to identify the underlying perspective or viewpoint of an individual or group towards a specific topic or target. This paper explores the challenges of stance detection, particularly in the context of social media, where brevity, informality, and limited contextual information prevail. While sentiment analysis focuses on explicit sentiment polarity, stance detection classifies the stance or viewpoint of a text towards a target, often of an abstract nature. This study introduces two multi-task learning (MTL) models that integrate sentiment analysis and sarcasm detection tasks to enhance stance detection performance. Four task weighting techniques are proposed and evaluated, and their effectiveness in the MTL models is demonstrated. Extensive evaluations on English and Arabic benchmark datasets highlight the advantages of the proposed models. Among them, the multi-target sequential MTL model stands out with its hierarchical weighting approach, as it achieves state-of-the-art performance. The study underscores the potential of MTL in improving stance detection and provides insights into the interaction between sentiment and stance, while considering the impact of sarcasm.