How to have enemies not go through a certain wall and let only the player pass through?

Imagine a square and having moving enemies that follow the player when he enters and they chase you. The player should be able to pass through a wall but not the enemies. There is a box with a little opening at the north side, and that’s the part where the player should be able to pass but not the enemies. I have no idea how to do this, please help me. The player should be able to pass through a collider but not the enemies. If you could show me a script or direct me to something similar to this that would be great.

assign the Player and the enemies different layers. assign the walls the same layer as the enemies. under Edit Prohect Settings Physics, remove the tick on the collision matrix between these layers.

It helped, but a little bit. I didn’t understand it too well. Could you maybe explain it in a different way?