The basics of how a CB radio works is similar to that of a two way radio. Both allow you to communicate with others over the public airwaves, but there are circumstances where one would be preferable to the other. I will try to outline the major differences here.
CB radios are primarily used in vehicles, so if you are looking to communicate with others only while in a vehicle then a CB is a great choice. With a CB you are not limited to talking to others in your caravan, it is acceptable to strike up a conversation with anyone.
Most CB's are designed to be connected to an external antenna, which can offer range far greater than that of a two way radio. Some individuals mount antenna's on their roofs to allow them to communicate via CB with homes that are miles away. With a 2 way radio, this would require a repeater which can be very expensive.
CB radios are better if you need to a way to call for help. Although it is rare, In some areas channel 9 is monitored by authorities for emergencies.
Bottom line: CB radios have an advantage when travelling and when you need more range without buying expensive equipment. They are great for communicating with both friends and strangers, and do not require a license. Disadvantages are portability, privacy, and the perform poorly inside buildings.
Two Way Radios
Two way radios (walkie talkies) are small and hand held, which makes them very portable. You can use a 2 way radio to communicate with a family member in another vehicle while travelling to a theme park, and then take the radio with you to use in the park. This wouldn't be possible with most CB radios. Even handheld CB radios can be rather large.
While conversations are not at all private on either a CB radio or a two way radio, two way's provide better perceived privacy. They offer features such as privacy codes which filter out the transmissions of other radios, making it appear that your group has the frequency all to yourselves. This makes two way radios a good tool for communicating with a group but, unlike a CB, they are not especially useful for communicating with strangers.
Two way radios are available in many frequency ranges. VHF two way radios work well outside, while UHF radios (such as GMRS and FRS radios) work well in many environments including inside buildings. Many types of two way radios, however, require a license which can be an added expense.
Bottom line: Two way radios have an advantage in portability, size, and privacy. They operate adequately in most environments including inside buildings. They are not intended for communicating with people you don't know, and range is usually less than 2 miles unless you buy expensive equipment like a repeater. Some types require a license.