arXiv:2512.02460v2 Announce Type: replace-cross Abstract: Searching and detecting communities in real-world graphs underpins a wide range of applications. Specifically, community search identifies a community for a given query, whereas community detection partitions the entire graph into multiple communities. Although they target different community analysis objectives, both tasks aim to uncover cohesive community structures and are complementary in real-world applications. Despite this connection, current learning-based solutions generally regard them as separate problems, necessitating task- and dataset-specific retraining. This separated learning paradigm limits the applicability and generalization ability of the existing models. To mitigate this limitation, we propose UniCom, a unified framework to solve both community search and detection tasks. UniCom centers on a Universal Graph Learning (UGL) stage that distills local and global community-aware knowledge from multiple source domains. Following UGL, the Domain-aware Specialization (DAS) stage supports on-the-fly adaptation to unseen graphs and tasks through transfer learning, avoiding costly retraining while keeping the model compact. Extensive experiments on both tasks across 16 datasets and 22 baselines have been conducted to ensure a comprehensive, rigorous, and fair evaluation. UniCom consistently outperforms all state-of-the-art baselines across all tasks while maintaining runtime efficiency.