As long as you get the right thread and length (which is the original question) that works, of course.
Bolts are not as simple as they may seem at first... are these for shear or tension, do they have a flanged or plain head, etc.
M14 is a huge bolt, probably the largest in the vehicle; it would have a shear strength of at least 40,000 N (four tons). Do you mean an actual 14 mm thread, or just a 14 mm head hex? Threaded fasteners are specified by the thread size, not the hex size; in metric, the thread size in millimetres is prefixed by "M". For example, the wheel studs and nuts for a car (such as the Leaf) are M12 (and commonly M14 for pickup trucks).
- a bolt with an M14 thread would typically have a 19 mm head hex in a car, even larger for non-automotive applications
- a bolt with an M12 thread would typically have a 17 mm head hex in a car, a 19 mm for wheel nuts, and a 21 mm hex for Toyota shank-style wheel nuts (bolts for brake calipers and major suspension components)
- a bolt with an M10 thread would typically have a 14 mm head hex (all but the largest mechanical connections)
- a bolt with an M8 thread would typically have a 12 mm head hex (substantial housing bolts, large electrical connections)
- a bolt with an M6 thread would typically have a 10 mm head hex (common small housing and bracket bolts, and electrical connections)
I'm guessing that these are M10 (with 14 mm hex) and M8 (with 12 mm hex) bolts.
A small note: the grade would presumably be "10.9", not just "10". Metric bolts follow ISO grades which have two values separated by a dot, not just one number like SAE bolt grades (in which Grade 8 is the usual "high grade" choice). OEM bolts may not show a grade on the head at all, because they are a specific part to meet a specific spec, rather than being marked for general-purpose use.