Hmm. The error message you have db.h version 5.3.21 and libdb version 5.3.28
seems unlikely to be correct. The MacPorts db53 port @5.3.28_0 is obviously going to provide version 5.3.28 of both db.h and the libdb library.
However, the version of the db53 port was 5.3.21 back in June 2017 when our binary of p5.26-berkeleydb was compiled for El Capitan. I would guess that the build system of p5-berkeleydb stored that version number at that time.
The solution is that we need to increase the revision of p5-berkeleydb to rebuild it, any time the version of db53 is increased. This seems stupid to me, but is apparently what the developers of p5-berkeleydb want us to do.