This can work if your DM agrees
Portable Hole says
portable hole creates an extradimensional hole 10 feet deep. (...) The cylindrical space within the hole exists on a different plane
The opening to the hole is a portal to an extradimensional space. The distance between different planes in general is likely unlimited (although this may be up to your DM, with the possible exception of the border ethereal).
However, the consensus is that treating the distance across the entrance of a portable hole as normal distance is OK. Based on this, you can have spell effects across the entrance target a creature, and the ploy would work, unless your DM rules otherwise.
You do not even have to have them take anything from you. You can just set up the hole with glyphs that carry a trigger like "If a creature I point at is within range, blast that creature". You could snuff out opponents in battle by using your action to open the hole next to them, moving out of blast range if needed, and pointing at the victim.
Like all exploits, while this can be a cool effect the first time you pull it off, it creates long-term balance issues. With enough time and gold, this allows you to turn your portable hole into a deadly bomb (and a single day is all you need). You then can use it over and over to take out key opponents and turn climatic fights into automatic wins. This would force your DM to mitigate, for example by putting heavy time pressure on you, or having someone steal or destroy the hole.
(You do not even have to own a hole, though. You can achieve a similar effect with the Demiplane spell, which does not require you to find a hard to acquire portable hole first).
P.S. In the original form of the question, the object itself was enchanted with the glyph. Taking the object out of the hole would break the glyph because Glyph of Warding says
If the surface or object is moved more than 10 feet from where you cast this spell, the glyph is broken, and the spell ends without being triggered.
With this approach the tactic could only work if you can trick them to enter the hole, or take the object right at the rim of the hole bending in. This would cause less exploitable balance issues, because you have to deceive your opponent into cooperating for the method to work.