There are T-lymphocytes, B-lymphocytes, and macrophages. Both T and B cells have memory cells after infection that can recognize an abnormal cell when it appears again. One type of T cell is cytotoxic (“killer T cells”) and can kill a virus-infected cell or cancerous cell, but it needs to find the cell first. This is not trivial when you have millions of infected cells. T cells appear earlier in an infection but are less successful than B cells. B cells mass produce antibody, which will basically tag a specific abnormal cell kind of like when we tag trees for removal in a construction site. Macrophages then come in and kill any antibody-tagged cell (this is what creates issues in autoimmune diseases--once a cell is tagged, it will be killed, even if that is not what should be happening). Because tons of antibody can be produced and sent into body fluids, antibody can tag abnormal cells for destruction very quickly. And once they are tagged, they are killed.
So, B cells are more successful at ending infection but they take longer to develop the ability to do so. Therefore, in practice, we rely on T cells earlier in an infection.
In the absence of memory cells, the latent period between exposure and mounting an immune response is longer because immune cells have never seen the abnormal cell before. This is why unvaccinated people often have more severe illness: while the immune system is taking several extra days to respond, they are getting sicker.