The most likely problem is that the transmission fluid is dirty. This can cause the car to hesitate. Check the fluid yourself, or take your car to a mechanic. In most circumstances changing the fluid itself will solve the problem; if it doesn't then you may need to replace your speed sensor.
When people have issues with their transmission they will often take their car straight to a mechanic to get it fixed. This can be very costly and many garages will tell less informed people that they need a new transmission altogether, when this isn't always the case. A new transmission can cost a lot of money, sometimes even more than what a car is worth. For this reason it's always important to try to solve the issue from the route of the problem.
The first step to take is to check the transmission fluid. Use your car manual to ensure that you know how much fluid there should be, and then use your dipstick to see if there's enough. If you don't have enough fluid then top it up. Sometimes this will be all that you need to do in order to fix the issue. If this still doesn't work then your transmission fluid or filters could be dirty. In this case you'll have to drain the fluid, clean the pan and filters, and then fill it back up with fresh fluid. Draining methods can vary from car to car; however there should be clear step-by-step instructions in your manual.
If you don't feel confident enough to perform this task then take your vehicle to a mechanic and tell them exactly what you want them to do and why. By proving to them that you have a little knowledge about cars you will be less likely to get ripped off if they try to overcharge.
Transmission should be checked when you take your car to a mechanic for a service. If you have recently had a service, which should happen at least once per year, then you should consider changing your mechanic. Problems with transmission fluid don't just come out of nowhere and it's basic practice for it to be checked during a service. Failing to make this standard check is very unprofessional and can result in very costly damages in the long run. It's always worth learning how to perform these basic checks on your car yourself in order to keep the maintenance up to scratch.