It wouldn't make much of a weapon against ships, as shields block transporter beams.
They block phasers and torpedoes too, but phasers and torpedoes still get used. And shields can be knocked down in battle. The failure of imagination of Trek's writers is that they assume that what you do when you batter a ship's shields down is to keep shooting phasers and torpedoes at it, instead of using your incredible unstoppable disintegration ray called a transporter. You could beam away their weapon emplacements or even the shielding on their engine core, because unlike phasers or torpedoes, transporter beams can
pass through solid matter, allowing precision attacks that no other weapon is capable of. Or, heck, just beam the enemy ship's crew into your brig, or into space if you're really mean, and that way you capture a perfectly intact prize vessel for your own use. There are
so many ways that transporters would make better weapons than phasers or torpedoes, but Trek writers never realize it because they're stuck with the assumption that they're just transportation devices.
Alternatively, perhaps the transporter recognises that a ship is an object and has trouble locking on to just bits of it - like trying to transport your liver and not the rest of you. It CAN be done (Bashir beams the O'Briens' baby out of Keiko into Kira) but likely not quickly enough to make a feasible weapon.
But -- if you posit that Starfleet engineers were interested in developing weapons based on the same principles as transporters, then obviously they could refine the technology to overcome those problems. I'm not talking about a spontaneous decision to improvise with a system that isn't designed as a weapon. I'm saying that, fundamentally, the weapons potential for transporter technology
should have been developed at the same time as its transportation potential, so that by now, there should be well-developed disintegrator weapons based on the same underlying technology as transporters. I mean, good grief, think about the
Enterprise era, when transporters had been invented but deflector shields hadn't. At that time, it would've made perfect sense that military engineers would've explored and developed the weapons potential of the technology, so it would've been refined into an effective weapon well before the DSC/TOS era.
Come to think of it, the TNG tech people missed an opportunity to explain that phasers
are based on the same physics as transporters, given that phasers on high settings do dematerialize objects. Maybe the stun and kill settings could've worked by beaming away some or all of the oxygen in your bloodstream, say.