(For 2D lasers)
The texture can be a cross-section of the laser beam, and you just scale it in one direction so it's as long as you need it to be. Then, if you don't want it to have a sharp cutoff, you place end textures at either end. So, basically a 9-slice texture.
http://i.imgur.com/oo6RBSk.gif
If you set the sprite offset so its origin is at one end, you can simply scale it. If it's origin is in the center, just calculate the center point and set its position every frame that it's active.
For the mechanics: Do a ray cast from your gun muzzle to some maximum range point. Get the distance between the muzzle and the hit point (or the max range point if there is no hit), and scale the texture based on that distance. You'll get a hit object from the raycast, so you can do damage to that. If you want it to pass through things and hit multiple objects, I've used an Area2D that's also scaled to length, and apply damage to anything in the area.