In Internet of Things (IoT) networks, Unmanned Aerial Vehicles (UAVs) play a critical role as mobile nodes that can be deployed to carry out data collection and computation. In this respect, this paper considers an operator that deploys UAVs to satisfy requests from IoT applications that require Virtual Network Functions (VNFs) that may communicate with one another to be executed at different geographical locations. To this end, this paper formulates a novel Mixed Integer Linear Program (MILP) to determine the optimal assignments of UAVs and VNFs over a planning horizon that maximizes a given performance metric, e.g., revenue. It also outlines a heuristic method named MPopLoc that chooses requests according to popular requested locations and traveling cost of UAVs. The results show that MPopLoc achieved approximately 95.14% of the optimal result.