The main difference between the 2px and 2py orbitals lies in their orientation in three-dimensional space. Both orbitals belong to the same energy level (n=2) and have the same shape, but they are oriented along different axes.
The 2px orbital is oriented along the x-axis, while the 2py orbital is oriented along the y-axis. Essentially, this means that if you were to visualize the electron cloud for each orbital, the 2px cloud would be lobe-shaped and extended along the horizontal direction (x-axis), whereas the 2py cloud would extend along the vertical direction (y-axis).
Both orbitals, like all p orbitals, are dumbbell-shaped and have two lobes separated by a nodal plane where the probability of finding an electron is zero. These specific orientations allow different overlap possibilities when interacting with other atomic orbitals during the formation of bonds, contributing to the properties of molecules.