Újhelyi joined the Alliance of Vojvodina Hungarians in 2007. He received the eighty-seventh position on the electoral list of the Hungarian Coalition, a multi-party alliance led by the VMSZ, in the 2008 Serbian parliamentary election.[3] The list won four seats, all of which were assigned to VMSZ members; Újhelyi was not included in the party's assembly delegation.[4] (From 2000 to 2011, Serbian parliamentary mandates were awarded to sponsoring parties or coalitions rather than to individual candidates, and it was common practice for the mandates to be assigned out of numerical order. Újhelyi could have been chosen for a mandate notwithstanding his list position.)[5]
Serbia's electoral laws were reformed in 2011, and since this time all parliamentary mandates have been awarded to candidates on successful lists in numerical order.[6]
Vojvodina held its 2012 provincial election under a system of mixed proportional representation. While VMSZ leader István Pásztor sought re-election in a Subotica constituency, Újhelyi led the party's electoral list and was elected when the party won four proportional seats.[7] The Democratic Party (DS) won the election and afterward formed a new coalition government that included the VMSZ; Újhelyi was a government supporter in the provincial assembly and was a member of the administrative, privatization, and finance and budgetary committees.[8]
Újhelyi did not seek re-election to the provincial assembly in 2016 but instead appeared in the sixth position on the VMSZ's list in that year's parliamentary election. The list won four seats, and he was not elected.[9] He became an economic advisor to the Subotica city government from 2016 to 2020, in which capacity he chaired the committee for the development of the municipal employment and general economic framework and was the manager for such projects as OPTI-BIKE I and OPTI-BIKE II.[10][11]
Újhelyi again received the sixth position on the VMSZ's electoral list for the 2020 Serbian parliamentary election and was elected after the party led a successful campaign to increase its voter turnout and won a record nine seats.[12] The Serbian Progressive Party (SNS) won a landslide majority victory, and the VMSZ afterward supported the administration in the assembly. In his first parliamentary term, Újhelyi was a member of the environmental protection committee, a deputy member of the culture and information committee and the European integration committee, and a member of the parliamentary friendship groups with Israel and the United Kingdom.[13]
He was again given the sixth position on the party's list in the 2022 parliamentary election and was not at first re-elected when the list fell back to five seats.[14] On 8 December 2022, he received a mandate to replace fellow VMSZ member Árpád Fremond, who had resigned to lead Serbia's Hungarian National Council.[15] Újhelyi served afterward as a member of the agriculture committee;[a] a deputy member of the finance committee,[b] the education committee,[c] and the culture and information committee; and a member of the friendship groups with Israel, Slovenia, and the United Kingdom.[16]
Újhelyi appeared in the sixth position on the VMSZ's list for the fourth consecutive time in the 2023 parliamentary election and was elected to a third term when the list won exactly six seats.[17] He is now a member of the finance committee and the culture and information committee; a deputy member of the foreign affairs committee, the agriculture committee, the European integration committee, and the European Union–Serbia stabilization and integration committee; and a member of the friendship groups with France, Israel, and the United Kingdom.[18]