Slightly outdated, but probably still accurate: Ukraine gets gas from its own reserves, but also imports some gas from Russia via Europe using reverse flow pipelines.
Boldface mine:
Historically, Ukraine has received the majority of its natural gas imports from Russia. However, following Russia’s annexation of the Crimean Peninsula, Ukraine halted direct natural gas imports from Russia and replaced those imports with natural gas from European countries. Much of the natural gas imported from Europe, however, originates in Russia and travels into Ukraine through reverse flows from central and eastern European countries.
U.S. Energy Information Administration. Last Updated: August 2021: https://www.eia.gov/international/analysis/country/UKR
What is reverse flow? See below:
Slovakia has started testing a reverse gas flow that aims to help supply neighboring Ukraine with badly needed natural gas.
Slovak company Eustream confirmed on August 16 that a compressor station near the town of Velke Kapushany started pumping gas into the Uzhgorod-Voyany pipeline earlier in the day.
Work recently finished on that pipeline so that it could carry gas eastward instead of westward.
Radio Free Europe/Radio Liberty: Slovakia Tests Reverse Gas Flow To Ukraine. August 16, 2014. https://www.rferl.org/a/ukraine-slovakia-reverse-flow/26534011.html