A constellation is more of a direction than a place, a sort of a three dimensional wedge of space extending from Earth to infinity. So saying that astronomical objects are "in" constellations can be a little bit misleading.
Basically the sky looks sort of like a hemispherical dome at any one time. And since Earth is a ball floating in space it looks like it is surrounded by a spherical shell.
It is impossible to see how far away astronomical bodies are - their distances have to be measured using precise instruments - so all the visible stars look like they are the same distance away. So for thousands of years scientists more or less assumed that the stars were lights on the surface of a spherical shell far beyond Earth.
And for thousands of years people have been noticing apparent patterns in the stars that appeared to be at the same distance. And so they gave names to those patterns and called them constellations. And as the Sun and Moon and planets moved around in space, each planet believed to be attached to an invisible crystal sphere, they appeared to move in front of various constellations, and thus they were said to be "in" those constellations, even though they were believed to be much closer to Earth than the shell of stars was.
And a few centuries ago the scientific revolution more or less destroyed belief in invisible crystal shells with planets attached, and thus in the sphere of stars, and astronomers became open to the idea that stars might be at various distances from Earth. After a century or two of attempts to measure the distances to stars, the distances to three stars were measured in the 1830s, 61 Cygni at over 10 light years, Alpha Centauri at over four light years, and Vega about 25 light years. Obviously they could not be attached to a spherical shell centered on the Sun.
In the 20th century, astronomers established official borders for the constellations. The simplest possible shape for a constellation is a rectangle drawn on the celestial sphere. Since the celestial sphere doesn't physically exist and space extends to infinity, the actual shape of a simplest possible constellation would be a sort of a pyramid, with a rectangular cross section and a steep slope, extending from the solar system to infinity.
And many constellations have more complex shapes, being composed of several attached two dimensional rectangles and thus being complex three dimensional pyramids extending from Earth to infinity.
And since constellations extend from Earth to infinity, saying that an astronomical body is "in" a constellation, or giving its coordinates on the celestial sphere, can show where to point a telescope at it, but doesn't say how far it is from Earth.
For example, the Moon passes through the Zodiac constellations as it orbits the Earth. The average distance of the Moon from earth is 384,399 kilometers. During solar eclipses, the Moon passes in front of the Sun, and thus appears to be very close to the Sun. But the average distance from the Earth to the Sun is 149,597,870.7 kilometers, or one Astronomical unit, or one AU. That is about 389.17 times as far as the Moon.
And sometimes the Moon passes in front of, and occludes, a star, thus appearing very close to that star. For example, in July 1997, the Moon occluded the star Aldebaran. Astronomers and science fiction writers measure large distances in light years and parsecs. A light year is defined as 63,241.077 AU, or 24,611,841.27 times the distance of the Moon, and a parsec is 206,264.806 AU, or 80,272,074.55 times the distance of the Moon.
Aldebaran is about 65 light years from Earth, and thus about 159,976,977 times as far from Earth as the Moon, so looking right beside each other just before the Moon occludes Aldebaran is not very informative about their actual relationship. Aldebaran appears to be a member of the Hyades star cluster, but the Hyades are actually about 153 light years or 47 parsecs from Earth. The Pleiades star cluster appears near to Aldebaran and the Hyades but is actually about 400 light years from Earth.
Stars in the Constellation Andromeda, that appear to be close together as seen from Earth, include:
Ross 248, only 10.32 light years from Earth.
Upsilon Andromedae, 44 light years from Earth, with four planets.
OU Andromedae, 440 light years from Earth, 10 times as far as Upsilon Andromedae.
HAT-P-32, 1,044 light years from Earth, 100 times as far as Ross 248.
HD 225518, 1,680 light years from Earth, 38 times as far as Upsilon Andromedae.
And of course the Andromeda galaxy, the center of which is 2,540,000 light years from Earth, or about 246,124.03 times as far as Ross 248.
It is quite possible for a star 100 light years from Earth to appear next to a galaxy 100 million light years from Earth, or for a galaxy 10 million light years from Earth to appear next to a galaxy that is 10 billion light years from Earth. It is perfectly possible for the Moon to occult a galaxy billions or trillions of times as far away as it is.
So saying that astronomical bodies are "in" constellations can be deceptive. It may narrow down the directions to those astronomical bodies, but it doesn't specify the very important distances to those bodies. It is perfectly possible for two bodies "in" a constellation to be so far apart that one of them is hundreds or thousands of times closer to a body on the opposite side of the sky than to the other body "in" that constellation.
Constellations should be thought of as directions instead of places.