Like terms have to have the same variables and the variables have to have the same powers.
3x and 6x are like terms.
3x and 6y are not.
4y^2 and 7y^2 are like terms.
4y^3 and 7y^6 are not.
2xy and 5xy are like terms.
2xy^2 and 5x^2y are not
2xy^2 and 5xy are not.