Newly devised fifth-generation (5G) and sixth-generation (6G) networks next-generation networks are extremely secure, low latency, dependable, and versatile. These next-generation networks differ from traditional networks (1G to 4G). As these networks offer diverse services namely; Massive Machine Type Communication (mMTC), Enhance Mobile Broadband (eMBB), and Ultra-Reliable Low Latency Communication (URLLC). In 5G and 6G networks, network slicing plays a crucial role to offer the aforementioned services over the same physical network. Network slicing permits operators to run several network instances on the same infrastructure. In order to improve service quality (QoS) and optimize network slicing, artificial intelligence and machine learning algorithms are taken into the consideration. The goal of this research is to develop an effective network-slicing method based on a hybrid learning algorithm. As a result, we suggested a methodology with three primary phases: loading the dataset, optimization using HHO, and slicing classification using a hybrid deep learning model. First, we load the datasets and apply HHO optimization for the best hyperparameter tuning. Thereafter, the proposed hybrid deep learning model based on convolution neural network (CNN) and long short-term memory (LSTM) is applied, combinedly known as HHO-CNN+LSTM. The obtained results of the proposed model are compared with various existing optimization, ML and DL algorithms. It demonstrates that the proposed model outperformed and predicted the appropriate network slices to offer excellent services. [ABSTRACT FROM AUTHOR]