Dear Student,
In the case of a prism, the two interfaces the light ray has to pass are not parallel to each each other and are inclined at an angle. In this case, the effects of the first interface are not reversed and the colors separated at that first interface continue along different paths upon leaving the glass at the second interface. Hence we observe a spectrum on the other side.
Whereas In the case of a glass slab, the two interfaces the light ray has to pass are parallel to each other. In this case the emergent ray is also a white light because the constituents of white light which are refracted at different angles at the first interface recombine at the second interface and emerge as a single white light.
Regards