Help with transmission....Please

I have a 2001 Focus sedan /w 100K on the miles. I've had a little trouble with this and I cannot quite figure it out. I think it may be
a transmission range sensor but I'm not sure.
The car seems to shift fine while driving but I can shift to R and all seems fine. But if I go from D to R the car seems to be in N. N will be drive. I have to go back to park for all to be normal again. Then once again in D and all goes haywire.
Any suggestions would be appreciated.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
Add image file
Upload is a website by car enthusiasts for car enthusiasts. It is not affiliated with any of the car or spare part manufacturers or car dealers discussed here. All logos and trade names are the property of their respective owners.