Capital ships get names.
Extend that to all important ships, ones that have done something of notoriety in the past and prototype/field-test ships.
Earthly-navies are small enough that most ships represent a significant investment of money and man-power to warrant uniquely naming everything. However, there's lots more space than there is water, so a potential space-navy may have too many ships to give names to.
Production-line ships get serial numbers.
The little shuttle that ferries crew on/off a giant capital ship probably doesn't deserve a name. But it does still need a unique identifier - that's where your serial number comes in.
Think of it like registration plates for your car. If your world has lots of private and commercial space-traffic and has regulatory authority over space-traffic then licence numbers are the most logical option.
If your world is the wild, lawless, frontier then you probably would forego all forms of labelling.
Generating registration plates/designations.
Think of how many ships you want to exist in the world. In total, even if they are irrelevant to your story. Times that by ten, or even a hundred. Your licence numbering scheme has to be able to account for that many ships.
Any scheme will do, but you might want to devote a few letters/numbers to indicate where the ship was registered, or what planet it's from.
By virtue of where I work, I happen to be exposed to how a military labels all their aircraft and boats. Aircraft designators are primarily by role, not by model.
I see a lot of aircraft following this pattern;
Or, letter, letter, dash, number, number, number.
The first letters is for role. F for fighter, B for bomber, C for cargo, etc.
The next letter is for type, the area of the military that owns it, or in some cases both at the same time. The letter S hints that this aircraft is a helicopter operated by the navy.
The numbers are completely arbitrary, but are picked by a person. People love patterns and rules - it makes organising things easier. Similar models, that are all stationed at the same location would be typically grouped by the hundreds, then counted incrementally.
- I'm not sure if I'm allowed to use real designations here. I know that they're Google-able, but I kludged together my own rules by substituting extra letters and numbers.
Generating serial numbers.
I'm also employed as an engineer. Past employment dealt with serial numbers for parts. Not whole objects, but I'll go out on a limb and assume the logic transfers neatly.
Serial numbers are to track the part back to the precise place and time it was manufactured. Tracking where the part has been installed previously is also a common thing.
The rules for these are similar to registration plates on cars. You need to gauge the total number of parts, and round up. Round up massively. Part serial numbers need to identify decommissioned/lost/destroyed parts as well as parts currently in circulation.
Serial numbers should have the following information squashed down into it:
Place of manufacture: uniquely name the planet+shipyard this thing came from.
Production Line: factories never build one thing at a time. If someone suspects a manufacturing fault, being able to trace it to a production line is a great way to filter out irrelevant ships.
Batch Number: things are often built is batches. This might be irrelevant for ships as they are large objects.
Time of Manufacture: The point in time the ship rolls(read:floats) off the production line.
Sequence Number: the position of the object within the batch.
[EDIT] Part Type: Identify what type of object this is (silly me forgot the most important part).
The place of manufacture is probably coded into two/three letters and numbers. Three letters gives you 17,576 unique combinations. Sounds like overkill, but it's future proof, which is a strong deciding factor for accountability.
If you want an example of serial numbers, go into the kitchen, collect all your canned and bottled food. Look for printed or stamped numbers on the bottom of the cans. Fast-Moving Consumer-Goods follow these principals as well.
Keep in mind there may be a disconnect between who designs and manufactures a ship, who uses it, and any authoritative body that's responsible for registration. Each group will likely have their own rules for labelling.