The primary goal of introducing device-to-device (D2D) communication underlaying cellular systems is to increase spectral efficiency (ES). However, it can lead to performance degradation caused by severe interference between cellular and D2D links. In addition, due to the complexity of control and management, direct connections between nearby devices are vulnerable. Thus, D2D communication is not robust against security threats and eavesdropping. However, if the physical layer security (PLS) concept is taken into account, the interference can help reduce eavesdropping. In this work, we address power control and resource block (RB) assignment problem to improve security of D2D communication and cellular network while satisfying the minimum rate requirements and power budget of the users. To solve this problem, we employ a decomposition method and individually address the power allocation and the RB assignment problem with lower complexity. However, RB assignment problem reduces to the three-dimensional matching problem, which is under NP-hard category and an optimal solution can be obtained through a complicated method such as Brute-force search or branch-and-bound with exponential time complexity. We, therefore, propose an approach based on tabu search (TS) meta-heuristic algorithm with reduced time complexity to globally find the near-optimal RB assignment solution. Moreover, we evaluate the performance of proposed scheme with a genetic algorithm (GA) based approach and other baseline methods. Simulation results show that the applied TS algorithm outperforms the GA since it employs both exploitation and exploration through a memory-based local search method and a perturbation mechanism, respectively. However, the GA, as a population-based method, focuses only on exploration by searching the entire search space without concentration on the current solution.