If you know the IP addresses of your friends (or IP address ranges), you can open up port 25565 but only to a certain range. If your friends have a static IP address then you would allow that single IP address (one for each of them). If they don't have a static one, then you will have to allow a range; they can ask their Internet Service Provider for the range.
See a page like this for an explanation of the command. See the section "Allow Incoming SSH from Specific IP Address or Subnet". Something like this:
sudo ufw allow from 203.0.113.0/24 proto tcp to any port 25565
Either way, once you open your computer to the world, there will be some risk of incoming traffic. You just need to accept it and besides setting up a firewall, you might want to backup, etc.
I don't play Minecraft -- I guess what it uses is port 25565. Why are you opening OpenSSH, too? Does Minecraft need it as well? If it doesn't need it, close it or limit the IP addresses that can connect to it. You can also change the the default port for ssh. See the discussion here. Note that changing the port just fools the people who will try port 22. And open port is still an open port.