Same way - some of the material explodes and it blows the rest apart. It might make less practical difference though, since flying antimatter is itself pretty hazardous.
As for sci-fi weapons in general, well anything in sufficiently hard sci-fi is viable by definition.
Movie energy weapons are probably not plausible as depicted mainly because a real energy weapon isn't going to produce a slow-moving glowing blob. But if we consider that as a cinematic convention - just like how bullets get depicted as sparking on impact - then things look more plausible. The
https://en.wikipedia.org/wiki/Pulsed_energy_projectile
comes to mind. It's probably the closest thing to a Star Trek Phaser that can be built. Like the phaser, the PEP can have selectable "stun" or "kill" power, and could be useful for heating things and making holes. The PEP though is a vehicle-mounted weapon, a long way from pistol-sized.