This problem shows the power of reversing your perspective. Instead of running BFS from each target cell to find the nearest source, run BFS once from all sources to find all targets.
Multi-source BFS computes the distance from every cell to the nearest source in a single pass. This is faster than running single-source BFS multiple times.
You'll see this pattern in: nearest exit in a maze, shortest distance to any land cell, time to reach all nodes from multiple starting points. Anytime you need distance to the nearest element from a set, push all elements into the queue first, then run BFS once. The first visit to each cell gives you the answer.