Right. Perhaps a better idea would be
apt purge apache2
but that’s assuming that your apache server package is named just that. You can see what all apache stuff is installed like
sudo dpkg -l |grep apach
You really need to un-install the main server part. The other stuff won’t hurt you and can get removed with
apt -y autoremove