The classification categories from most to least inclusive: kingdom, phylum, class, order, family, genus, species.
If two organisms are in the same phylum, they must also be in the same kingdom, as a phylum is a part of a kingdom. They can be in different classes and/or orders.