First off I believe you are talking about PCIe X4 slot. The PCIe 4.0 specification is not finalized and I have not seen any motherboards or cards that support PCIe 4.0 if you have Im jealous.
Anyway, if you have a pcie x16 slot that is the ideal slot to use for your gpu. Electrically a x16 gpu is compatible with an x4 slot, but you may run into physical issues. Some PCIe slots have the back removed so you can put an x16 card in a x4 slot, if not you can always cut out or file away the back plastic to fit the card in, hackish but I have made it work before.
Definitely recommend using an x16 slot though if its available. You generally want to be in the slot that is connected to the CPU PCIe lanes, which is usually the top x16 slot. What...