a firewall keeps ports closed or open that you are or are not using.
so it does keep people out to some extent. they can still enter through open ports, so it's not a complete solution. combined with other options such as AV or antimalware software covers most bases.
cookies work from within your browser so it is what will have to manage them. most browsers give you some control while others give you total control. if privacy is a concern i'd avoid chrome and most everything associated with google.
i personally have Firefox set to reject most every cookie except session ones and then it auto-deletes everything when the browser is closed. only a couple cookies are in my whitelist to stay on the machine.
for instance the one needed to keep me logged in here is allowed to stay and a couple others for similar reasons. everything else if allowed, only stays as long as the browser is open.