So if:
Pikachu uses Knock Off before my Ludicolo uses Rain Dance, will Rain Dance last longer or will it just be the same regular 5 turns?
Because the damp rock was knocked off before Rain Dance was used, Rain Dance will last for only 5 turns.
It will only last for 5 turns. It will only increase to 8 if it is holding the rock, so when it loses the rock it loses the turn increase.