TUCSON, Ariz. (AP) Arizona had trouble guarding anybody in the first half, slow to rotate out to shooters, allowing UCLA to repeatedly get to the rim.

The Wildcats looked like an entirely different team in the second half, contesting shots, bumping the Bruins off the ball, harassing them for every inch.

The difference wasn't some adjustment or change in scheme. It was just a matter of intensity and attention to detail.

More from FoxSports

''We had the same players and the same scheme, we just did it at a much better level,'' Arizona coach Sean Miller said after the 17th-ranked Wildcats outlasted UCLA 81-75 on Friday night.

Arizona (20-5, 8-4 Pac-12) stumbled through a lackluster first half at both ends to trail by 10. The Wildcats tightened up defensively in the second, anchored by Kaleb Tarczewski in the middle, with Gabe York and Allonzo Trier chasing shooters off screens on the perimeter.

Arizona started hitting shots in the second as well, some by getting out on the break after defensive stops.

Parker Jackson-Cartwright, who started in place of Kadeem Allen (ill), was the offensive spark in the first half and hit a big shot late in the second to finish with 16 points.

Trier did most of his damage after ditching a brace on his right hand at halftime, scoring 15 of his 18 points in the second half. York chipped in 15 and hit a big shot of his own with under a minute left.

''We didn't have to make big adjustments, we just had to play hard,'' said Jackson-Cartwright, who added four assists.

UCLA (13-11, 4-7) was in control until the fouls started piling up.

The Bruins had centers Thomas Welsh and Tony Parker foul out in a span of 42 seconds late in the second half and Arizona took advantage by pounding the ball inside.

Kaleb Tarczewski and Ryan Anderson combined for 27 rebounds, and Arizona made 29 of 45 free throws for a massive advantage at the line.

Isaac Hamilton scored 24 points and Bryce Alford had 17 for UCLA, which was 12 for 16 on free throws.

''It was hard to keep them at bay when one team is getting 45 free throws and one is getting 16,'' UCLA coach Steve Alford said. ''Hopefully, we won't foul as much in the next game.

UCLA won the first meeting 87-84 on Jan. 7 at Pauley Pavilion when Alford hit a 3-pointer with 1.8 seconds left

The Bruins have struggled since then, losing four of seven, including an 80-61 blowout by rival Southern California.

UCLA controlled the rematch early, effectively working the ball around as Arizona struggled with the Bruins' ball screens. UCLA had a 17-4 run midway through the first half and made 17 of 32 shots to lead 44-34 at halftime.

Arizona was impatient on offense, settling for jump shots instead of getting the ball inside or to the rim. The Wildcats made five shots inside the 3-point arc and were outscored 22-10 in the paint in the first half.

''We were lucky to be down 15 at halftime,'' Miller said.

The Wildcats tightened up defensively in the second half and Trier scored nine quick points, highlighted by an alley-oop dunk on a feed from York and a long 3-pointer to beat the shot clock to pull the Wildcats within four.

Arizona's ability to draw fouls began to cause problems for UCLA late in the second; Welsh fouled out with about 6 1/2 minutes left and Parker was right behind him after re-entering the game.

The Bruins still kept up with the Wildcats, hitting one clutch shot after another in the closing minutes.

The Wildcats hit the biggest ones down the stretch, though: a 3-pointer by Jackson-Cartwright and York's three-point play with 54 seconds left to cap a 9-0 run that put Arizona up 78-70.

''I thought our guys got frustrated a little because of the flow of the game,'' Alford said. ''If you have two centers that commit 10 fouls, that makes it extremely hard on us.''

ALLEN'S ILLNESS

Allen played 21 minutes, but was not himself due to a lingering virus. Miller said he threw up three times Friday night, including once during the game, and missed his three shot attempts, finishing with four points. Allen has been battling the virus for nearly two weeks and Miller said the medicine was causing his upset stomach.

TIP-INS

UCLA: Hamilton scored in double figures in 20 straight games, longest by a UCLA player since Kevin Love did it in all 39 games of his freshman season in 2007-08.

Arizona: The Wildcats had a 42-34 rebounding advantage and scored 14 second-chance points. ... Arizona had three turnovers in the second half, finishing with nine.

WHAT'S NEXT

UCLA plays at Arizona State on Sunday.

Arizona hosts No. 23 USC on Sunday.