The fifth-generation (5G) network assimilates terahertz bandwidth and machine type communication (MTC) for swift and reliable data transfer and information exchange. It incorporates sophisticated cloud, Internet of Things (IoT), and other software-defined architectures for providing scalable service support. However, due to the heterogeneous integration of devices and architectures, secure infrastructures needto become mandatory. In this article, a Blockchain-based Versatile Security Framework (BVSF) is introduced to provide robust and adaptable authentication and access control in the 5G environment. The proposed framework allocates blocks for user equipment (UE) authentication and resource access control in a parallel manner. The verification of security level between resources, infrastructures, and UEs aids in extending or attenuating blockchain services. Based on the different security level assessments, the UE requests are precisely mapped or reallocated to the resources, improving the response rate and the framework adaptability.