Try putting the environmental variable assignment after sudo:
sudo ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" pip install gdal
Or, become root, then do the export:
sudo su -
export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" install gdal
pip install ...
It appears that the sudo command does not inherit the environmental variables, and they certainly aren't saved across multiple runs with sudo:
$ export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
$ sudo printenv | grep ARCHFLAGS