The growing diversity and complexity of network infrastructures have made detecting Distributed Denial-of-Service (DDoS) attacks increasingly difficult, particularly within heterogeneous environments. Traditional detection methods often struggle to maintain high performance across varied network conditions. However, this study addresses the issue by proposing a Collaborative Intrusion Detection System (CIDS) that utilizes ensemble stacking of multiple deep learning models to improve generalizability and detection accuracy. The framework combines several deep neural networks as base learners, with a meta-learner that integrates their outputs for final prediction. Evaluations were conducted using three NetFlow-based datasets—NF-ToN-IoT, NF-BoT-IoT, and NF-CSE-CIC-IDS2018—each representing different network states. The proposed method achieved a peak accuracy of 84.7\%, demonstrating that the ensemble stacking approach significantly enhances DDoS detection capabilities in collaborative and heterogeneous network environments.