In this particular case I would just have included the starting < in the search and replace.
In Vim I would do
:%s@\(</\?\)div@\1p@g
It’s a little bit convoluted but it replaces the tag names in both opening and closing tags and does not replace it anywhere else.