Both are equally effective at getting rid of dirt and bacteria on your hands, it just depends on your preference.
Bar soap usually includes cleaner ingredients that are gentler on your skin, which is important if you suffer from allergies or sensitivity - but if you’re worried about contamination or are sharing it with lots of people, liquid soap is your best option.