definitly the splines.....it takes 30 min to swap one out and you dont even have to remove the transfer case
1) unbolt the front shaft and inspect damages. use a flash light and check the splines on the transfer case side *female input* the 1st inch should feel or look like their rounded but you still got another 1-2 inches of brand new splines in there.
2) you need this:
BMW X5 - NV125 Drive Line Shaft [NV125DLS-EXT] - $601.99 : , Cobra Transmission
3) all you have to do is loosen the bolts that hold the transfer case to tranny then loosen the crossmember
4) by doing that you can now grease the splines and slide the new shaft in and bolt it back up then tighten things back down.
5) there was also a member here who made the shafts but i have not seen him on here in a while...
its worth saving it even if the shaft lasts let say 1yr-2yrs before it goes out again....
PS: it could also be your right front axle too......my axle popped out from the front diff and my X did the same thing..it didnt move in D or R and had the grinding noises....after that repair 3yrs later the drive shaft splines went.. so inspect your front left/right axles if you can especially since you said when you turned you had issues...