How can I make a UFW rule specific to my home wifi network without changing profiles?

You can configure UFW to allow (or deny) traffic to specific interfaces, but not networks. If it’s possible to use a wired connection at home and WiFi when out and about, then you can do something like this:

sudo ufw deny ssh on wlan0
sudo ufw deny samba on wlan0

Note: Be sure to change wlan0 to the actual interface where you want to block Samba and SSH.

Alternatively, it would be possible to write a script that disables SSH and Samba every time your system sleeps and/or shuts down, meaning you would have to remember to start the OpenSSH or Samba service manually before using it.