A target gun is a gun where accuracy is the top priority, with reasonable reliability and no regard to ease of carry or concealability.
They tend to have tight clearances and do not tolerate dirt or neglect well. Generally heavier, longer barrels, lighter triggers, adjustable sights that offer good sight pictures and discern small errors in aiming well. Grips are usually able to be modified or replaced relatively easily. Most often, although not always, they are gunsmith friendly and easily modified to fit the user. Think S&W 41, Pardini, Hammerli, 1911's set up for bullseye, etc.
A service handgun generally favors reliability over accuracy and concealability. Tolerances are slightly looser to tolerate dirt and abuse, accuracy is acceptable but not fantastic, generally larger and not readily concealable, sights are good but not complicated and designed to handle abuse, trigger pulls are heavier and often longer, grips are not always replaceable or modifiable. Think, Beretta 92, 1911 in stock configurations, Glock, M&P, CZ 75, etc.
CCW firearms generally favor concealability, with reliability second, and accuracy third. Weights are lighter, barrels are shorter, sights are fixed and simple, overall design hugs or compliments the body to hide under garments, with grips being smoother and lower profile. Think COMPACT Glocks, shortened 1911's, snub nose revolvers, PPK, pocket pistols, etc.
People can and do use firearms for purposes other than designed and may carry full size combat pistols, or carry a target gun, or shoot a service pistol on a target range, etc. So the distinctions are not rigid.