As the Internet of Things (IoT) evolves and is integrated into cutting-edge Smart Vertical Networks-based IoT, a plethora of IoT mobile devices (IMD) must contend with the increasing processing demands of time-critical tasks. The dynamic nature of the environment raises novel challenges for networks that use mobile edge computing. As a proactive response to these issues, the concept of ultra-dense IoT with Mobile Edge Computing has emerged. Within this architecture, Integrated Mobile Devices (IMDs) can save power and preserve their internal processing resources by offloading compute-intensive tasks to servers located at the network’s periphery (the “edge”). Nevertheless, the increased efficiency comes at the cost of greater transmission overhead, leading to an elevated delay. To achieve an ideal equilibrium between energy preservation and latency reduction, we propose a new optimization problem that focuses on minimizing both energy utilization and latency in ultra-dense IoT networks with multiple users and tasks. This issue entails the complex optimization of concurrent user (IMD) associations, computation offloading decisions, and resource allocations. To achieve a fair distribution of network load and maximize the utilization of computational resources, we integrate multi-step computation offloading methodologies into the issue formulation. Finally, the Adaptive Particle Swarm Optimization (PSO) technique is utilized as an intelligent way of solving the problem. Significantly, our methodology exhibits a noteworthy improvement over traditional Particle Swarm Optimization (PSO) techniques, resulting in a substantial decrease in overall expenses, encompassing reductions that span from 20 to 65%.