5G-based Vehicular Social Networks (VSNs) demand an advanced location and trajectory privacy preserving scheme for vehicles. Because VSNs present the characteristics of high mobility and multiple hop relays, we design a 5G-based VSN framework that incorporates Mobile Femtocell (MFemtocell) technology. Then, we propose the Dynamic Group Division algorithm (DGD), which is suitable for the dynamic properties of 5G and meets the real-time demands of VSN. To preserve privacy, the DGD algorithm increases the likelihood of exchanging pseudonyms via the proposed Group Generating Protocol and Pseudonym Exchanging Protocol. Then, we adopt the composite metric KDT (where K is the average anonymity set size, D is the average distance deviation, and T is the anonymity duration) and pseudonym entropy to quantify the degree of privacy. We evaluate and validate the effectiveness of our proposed algorithm based on the following three aspects: anonymity set size, distance deviation and pseudonym entropy. The simulation results show that our DGD algorithm better protects the location and trajectory privacy of VSNs while sustaining higher real-time demand than current approaches.