The Internet of Things (IoT) can be described as a considerable number of sensors and physical devices connected to different applications, supported with networking technologies to communicate with other devices and the Internet. With the growing number of IoT users, emerging services, and the need for high availability and data exchange, cyberattacks on those applications have increased in recent years. Therefore, securing IoT applications has allured particular consideration from the industry and research fields. This article illustrates and comprehensively analyzes the effectiveness of using FL/TL trending techniques used with different Machine Learning (ML) and Deep Learning (DL) algorithms to drive the Intrusion Detection Systems (IDS) to secure the IoT applications. The Internet of Medical Things (IoMT) is considered in this article as a use case in which we have demonstrated that using federated and transfer learning can improve model performance, increase learning process speed, reduce the amount of data needed to be trained, and preserve the user's data privacy compared with the traditional learning approaches.