Generally no. When you get a cold you are immune to that particular cold. The problem is there are about 200 different rhinoviruses. The rhinovirus causes colds.
Same with flu, you get a particular strain of H1N1, you are now immune to that flu, but H1N1 can mutate, and there are many other flus, so you can still get the flu, but not the exact same one.
Bacterial infections you typically don’t build that type of immunity. You can get strep throat more than once.