The strongest determinant of speed in a kayak is the paddler and their strength/endurance. I paddled my Stellar S14 G2 (14.5 ft, 24.5") faster than an well known instructor in a P&H Scorpio which is over 3 feet longer and half an inch narrower (17.7", 24"). But I am well trained, lift weights and work out like crazy due to my chronic illness like over 2h a day on weekdays, more on Fridays and maybe like 5-6 hours Sat and Sun. 95% of my activity is physically active.
The second most important element is length, followed by aspect ratio. So yes a longer kayak can be faster but it has to be long AND narrow, like pencil shaped and sleek. An 18 foot kayak that is 30 inches wide will never be as fast as say a 16 foot kayak that is 21 inches wide for example.
The third is kayak construction. Stiffer means more power put to water and more efficient. So a carbon composite will be faster than kevlar composite which is faster than fiberglass composite which is faster than ABS which is faster than rotomolded all else being equal.
Hull shape is also very important. Flat hulls will be slower due to greater wetted surface area which creates drag and slows you down.
The final element is overall weight. This affects speed very little, there is an equation you can find but yes a lighter boat will always draw less water. But it can also be your gear, paddler weight (go on a diet, get faster!), accessories etc. Not to be excessively roundabout but once you bring about weight another the important element is weight vs wetted surface area so maybe a heavier kayak that has less wetted surface area might actually be faster than a lighter one with a more flat hull.
Also planing counts. I have found that the nicer, higher end kayaks seem to just keep going faster and faster the more in shape I am. With a double I am always faster with a faster paddler. There seems to be no real top speed (yet) as the harder I paddle the higher it seems to sit and the more it wants to go within certain limits. OK an 11 foot pack boat has its limits but with slightly longer boats I have found my speed to grow with time and so has the “planing”. This is a nice feature because when you’re not moving the wetted hull is wider so you’re more stable, but when you get going and don’t need the width for stability it planes and becomes “skinnier”. So there’s that element as well.
So overall speed is really a complex matter. It can be very individual. A lot of people get longer boats thinking they will be faster but the extra weight and wetted surface area and their own potential lack of strength will slow them down.
Said differently all else being equal a shorter kayak will always be EASIER to paddle below its hull speed than a longer one with a faster hull speed. So look below. I am pulling these figures out of my head but just doing it for comparison
A 12 foot kayak with a 3knot hull speed will always be easier to paddle than anything longer up to pretty close to 3 knots.
Once you get to 3 knots a 14 foot kayak with a hull speed of 4 knots will be easier to paddle pretty close to its hull speed than anything longer.
Once you get to 4 knots a 16 foot kayak with a theoretical hull speed of 5 knots will be easier to paddle until you get to its theoretical hull speed.
And finally and 18 foot kayak with a theoretical hull speed of 6 knots will be the fastest overall but the hardest to paddle until you get past just under 5 knots.
So in the end you need to select a boat for the intended hull speed and physical fitness you’re capable of paddling. Stability is also more important than ability. I tried a surfski once that was supposed to be kind of fast and felt I couldn’t breathe without flipping it so you have to keep the stability that your skill level and height/weight can support in mind as well. Certain elements like stiffer or lower weight can make better the same situation but the most important factor is what you can sustain for prolonged periods.
From what I have read the optimal length (also for storage and carrying reasons as a longer boat of same weight just feels a lot heavier and is harder to load, store) is about 14 feet. More seasoned paddlers will likely want a longer boat but if you’re beginner to intermediate most people will be pretty happy with that length giving room to grow yet not being saddled with something too hard for other reasons. 14 foot (and under) boats are also more in demand so will be easier to re-sell later on if you get so good you want something longer/racier.