As long as the bolt passes all the way through the nut it will be ok.
Put a washer either side to spread the load if you can get one in.
If the bolt is too long then screw the nut on passed the point that you need to cut it off and then chop the end off with a hacksaw, tidy it up with a file and then take the nut off. If you do this you'll have no difficulty getting the nut on after as cutting through the thread may slightly bollox the thread i you don't.
Get a plain nut for chopping it off and a nyloc nut for on the bike.
As Militant Graham said you'll be able to get loads more torque on the bolt as it's a coarser thread so be careful you don't do it up too tight or you'll kill the bearings very quickly as they're not designed for big side loads