Life transference doesn't work with glyph of warding at all
Glyph of warding says:
The spell must target a single creature or an area.
However life transference actually has two targets: you, the creature that is harmed, and the other creature who is healed:
You sacrifice some of your health to mend another creature’s injuries. You take 4d8 necrotic damage, and one creature of your choice that you can see within range regains a number of hit points equal to twice the necrotic damage you take.
Being damaged or affected by a spell is generally considered enough to be considered a target of a spell. Thus, it shouldn't qualify to go into glyph of warding at all.
The above is what I view to be correct RAW and would run at my table, but because it is not explicitly declared who the targets are, your DM may disagree and rule otherwise. If they do, see below.
If your DM rules that the caster is not a target it would work
As J.A. Streich's answer also says, if your DM rules that the caster is not included in the targets of the spell then it qualifies to be put into the glyph of warding. The way it would work is that upon casting, nothing would happen except the spell being stored in the glyph.
The spell being stored has no immediate effect when cast in this way. When the glyph is triggered, the stored spell is cast.
Then, when the glyph is triggered, the caster should take the damage (because they are the "you" who cast the spell) and the triggerer should receive the healing. The glyph doesn't cast the spell, you still did. The effect is just taking place later.