The issue you are having is that the barrel locking lugs on the Gen 5 G17 are shorter than the barrel locking lugs on the Gen 4 G17 barrel.
Can you move the slide at all?
If so, then pull the slide back just enough to release the slide lock lever and then make sure that the trigger and firing pin are in the forward/fired position. Once both are done, then the slide should come off.