As per @xMudrii reply you can use UFW in order to do that.
UFW, or Uncomplicated Firewall, is an interface to iptables that is geared towards simplifying the process of configuring a firewall. While iptables is a solid and flexible tool, it can be difficult for beginners to learn how to use it to properly configure a firewall. If you’re looking to get started securing your network and are not sure which tool to use, UFW may be the right choice for you.
You can check our full tutorial here for Debian 10:
Allowing Specific Port Ranges
You can specify port ranges with UFW. For example, some applications use multiple ports instead of a single port.
For example, to allow X11 connections, which use ports 6000-6007, use these commands:
sudo ufw allow 6000:6007/tcp
sudo ufw allow 6000:6007/udp
Hope that this helps!
This tutorial will show you how to set up a firewall with UFW on Debian 10.