All that @paolo wrote is right.
Maybe I can build on that a bit and maybe find the source of the confusion that is NOT related to either Unifi or this forum.
When we talk about networking there is a “reference model” that organizes the network in 7 “layers” (the “OSI reference model”).
When we speak about VLANs and subnets we focus on layers 2 and 3.
The lowest layer (layer 1) is the physical layer, which takes care of the electronic (or optical) signals over the physical medium (how the network adapter puts and reads electrons on a wire or light on fiber optics). This is not affected by either VLANs or subnets.
The next layer (layer 2) is the data link layer which deals with the protocols between stations that share a medium.
Ethernet originally consisted of a single cable where all stations connected to the same coaxial cable (10base5). It eventually evolved to stations connected to a hub (and then a switch) where each cable connects only one station to the switch, but the implicit logic is that somehow the medium is shared by all the stations.
VLANs live in layer 2 and are used to create “virtual” physical media (cables) over the same medium, as if there were multiple independent switches (and multiple independent network adapters on the hosts).
We use IEEE 802.1Q to add a small VLAN header to the ethernet frame to add a 12 bit “VLAN Identifier” (VID or VLAN-Id) that indicates to which “virtual cable” or “virtual interface” this frame has to go. Values 0 and 4095 are reserved, so this lets us with VLAN IDs from 1 to 4094.
The next layer (layer 3) is the network layer which deals with addressing and sending packets from one node to another even when there is no direct connection between the nodes.
IP (version 4 and version 6) lives in layer 3. So do all the routing protocols (BGP, RIP, OSPF, etc). IP addresses are defined here.
Subnets which are partitionings of the address space, thus, also belong in layer 3.
This is where you define that subnet 10.10.10.0/24 is used for PCs in the 4th floor and that subnet 10.11.12.0/24 is used for servers in the data center.
There are quite a few sources of confusion here and even some professional sysadmins have problems with this since they usually learn a specific technology from a specific vendor and learn this vendor’s jargon and way of doing subnets and VLANs (e.g: @StoneMonarch learnt it form Unifi’s way of doing things which is quite peculiar, as @LTS_Tom stated more than once).
Other source of confusion is this. Theoretically, routers do layer 3, switches do layer 2. However, some routers (especially those for SOHO or branches) have a built-switch and many mid to high-end switches have some layer 3 support where it can route packets among different subnets without relaying them to a router.
For some rules of thumb, this might help you:
- Subnets are identified by IP addresses and masks (like 192.168.77.0/24 or fcae:ea51::/64).
- VLANs are identfied by VLAN IDs, which are numbers between 1 and 4094
- VLANs are used to simulate the existence of multiple physical networks and adapters
- There may be more than one subnet over the same VLAN but this is uncommon and you shouldn’t do it unless you know precisely why
- You shouldn’t use the same subnet over different VLANs