Oh, Uncle Bob. You just don't know when to quit. Your jokes start out funny and end up with the Holocaust. It's always too soon.
There are many ways to deal with racist/sexist jokes. Many of us just ignore them because we value keeping the peace. If this is you, no judgement.
Some of us escalate quickly by saying something like, "How can you even say that?!" This tends to start an argument and put the joker on the defensive, which may be exactly what he wants - a lot of these people just like the attention of being the outrageous one. You also run the risk of making your host/ess uncomfortable by calling out one of his/her guests.
Some people prefer to laugh awkwardly, or weakly. Let me encourage you to avoid this, because it may encourage the joker to think this kind of behavior is okay. S/he obviously hasn't mastered the art of conversation because s/he is resorting to crude humor to feel comfortable, and therefore s/he may not notice that you are uncomfortable with the joke.
One way to deal with this, and the one that I recommend, is to ask the person to elaborate. For example, if the joke deals with racial stereotypes, you could ask what the joker meant, or why the joke is funny. Sometimes this forces him/her to state outright a racist belief, and this can make the joker realize that it's inappropriate. Another way to get to the same result is to try to engage the joker in meaningful conversation about the joke. You can ask if s/he hates the target racial group, or ask why s/he feels negatively toward women. You can also pretend that you don't understand the joke. For example, if Uncle Bob makes a joke about sexual assault, you could say, "I must be confused. How is rape funny? Would you explain?" You may also be able to make the person realize that what s/he said is inappropriate by pointing out that it's uncommon: "Wow, I haven't heard that word in a long time," or, "I didn't know people were still telling sexist jokes like that."
If you are feeling brave, you can also straight up call someone on his poor behavior. It's within your rights to politely point out that you don't find that kind of comment to be funny. If Uncle Bob is perpetuating a stereotype, you can say something like, "I don't think that's funny," or, "Racist jokes aren't appropriate in this family." You can also say, "I wonder how (friend who is in the target group) would feel if she knew my uncle said that about her," or, "I wonder how you'd feel if someone said that about your daughter/wife/mother."
If it's your house, you can just ask Uncle Bob to stop. "Please don't make racist comments in my home." You can bring the kids into it, too: "I don't want my children to be exposed to sexist comments like that."
Unfortunately, some people are jerks. You will probably not completely change Uncle Bob's attitudes. But at the very least, he'll think twice before he tells another off-color joke to you! And a big part of what is important in speaking out is the act of making sure that if anyone nearby is the target of the joke, they know that they have allies. It makes a huge difference to hear someone stand up for you, even if it's only once. You could also come to realize that the rest of your family doesn't want to hear that kind of trash either, but they were too afraid to say anything. When you politely and thoughtfully speak up against bigotry, you are helping to change the whole culture of your family!