Any PCIe card will physically fit into any PCIe slot that is the same size or larger (with one exception: x1 cards require an open-ended slot, explained below). However, a larger card will not fit into a smaller slot.
The number after the "x" indicates how many lanes the slot supports. A single lane consists of two pairs of wires—one for sending and one for receiving—enabling simultaneous full-duplex communication.
The longest slot at roughly 89 mm. It is the "superhighway" reserved for graphics cards (GPUs) and AI accelerators that require massive bandwidth. Physical vs. Electrical Sizes Question - Difference between pciE electrical an mechanic
Motherboard manufacturers often install a plastic x16 slot but only wire it for fewer lanes to save money or due to CPU limitations.
The physical size of the slot dictates the number of lanes, but the PCIe generation dictates the speed of those lanes. The slot shape has not changed over generations, but the speed has doubled with each iteration.
As technology continues to advance, PCIe sizes are expected to evolve as well. The latest PCIe 4.0 standard offers even higher speeds, with a bandwidth of up to 985 MB/s per lane. Additionally, the upcoming PCIe 5.0 standard promises to double the bandwidth again, making it an exciting time for PCIe enthusiasts.