You dont ahve to go out of your way to buy a 10ft rod if you dont want to.
A longer rod allows you to cast much further, and have a better control of the fish (you can move the tip of the rod in a wider arc than a shorter rod).
That being said, I use my 7ft rod for pier fishing all the time.
For carp, unless you are throwing heavy rigs (bolt rig, some kind of feeder rig, etc), then any rod would do. For normal hair rig or just corn on a hook, ANY rod can be used.
And yes, any rod can be used for panfish, as long as you have a small, sensitive float.