To upgrade postgres you can run
brew upgrade postgresql
After you've done that your existing databases will have data that is incompatible with the your new postgres binary. Normally you would have to use pg_update and pass in the correct binaries to migrate the data, however, brew includes an upgrade script to update the data for you.
brew postgresql-upgrade-database