Contrary to what popular marketing would have you believe, protein shakes are not magic – they’re just protein. Mass gainers are just protein and carbs. Both are effectively nothing more than powdered food.
Their advantage over traditional foods is how fast, easy, and convenient they are to transport, prepare, and consume. If it is helpful to your schedule and diet to incorporate them, then you should feel free to do so. Ultimately, what really matters is that you are hitting your macronutrient and calorie goals for the day.