Well yeah, that's going to affect the overall lifespan of the battery but it's also very dependent on how long you're leaving your phone plugged in to that USB port, and there are a lot of variables.
-- Which type of USB port you plug into is a factor -- USB 3.x ports can supply more amperage than USB 2.x ports
-- A typical USB cable is going to have wires/connectors dedicated solely to power transfer and to data transfer so your phone is always going to automatically link itself to receive power, essentially a lower-level firmware function, but data transfer connectivity is more of just a software thing (how your Android OS is configured and if you, the user, initiate something like file sharing or remote access).
-- Your phone's battery has a set number of life cycles and that's a given. A very loose, very generic number that's commonly used is 500 or so. But each time you charge your phone, that's not just minus one life cycle (i.e. 499), it's an accumulative matter so if the battery gets a 25% charge every time you plug it in than it takes four times to equal one life cycle down (4 x .25 = 1), or if only 10% each time than it would take 10 times to be the equivalent of one life cycle down. Whittle away one life cycle at time from that 500 number and that's approximately how long before your battery will last. Keep in mind while every battery has a life cycle limit, that 500 number is more of a low-balling estimate. Most will last longer, but that's also dependent on how your charge your phone. If you run it down to single digits of a charge each time, that's going to drastically reduce it's overall life.
-- A good source on learning about batteries in general is the Battery University site. Its articles get updated on a regular basis so you're much less likely to read out-of-date or inaccurate facts there, something that's often a big problem online.
So you need to take in all the variables involved that apply to your particular situation, and then see if it's actually something to worry about. If you do a lot of file transfers and leave your phone plugged in for long periods of time, it may be something to consider. If it's just a matter of a few minutes each day, the numbers don't add up to anything significant.