First Last Last First
JavaScript (ES6), 63 bytes
(x,y,a)=>a.map(P=(v,i)=>v-y?v-x?0:a=i:1/(p=a)?P=+P||i:0)&&[P,p]
Try it online!
Commented
(x, y, a) => // given the two integers x, y and the array a[]
a.map(P = // initialize P to a non-numeric value
(v, i) => // for each value v at position i in a[]:
v - y ? // if v is not equal to y:
v - x ? // if v is not equal to x:
0 // do nothing
: // else (v = x):
a = i // save the current position in a
: // else (v = y):
1 / (p = a) ? // update p to a (last position of x); if p is numeric (>= 0):
P = +P || i // unless P is also already numeric, update it to i
// (if P is numeric, it's necessarily greater than 0 because
// we've also seen x before; that's why +P works)
: // else:
0 // do nothing
) // end of map()
&& [P, p] // return [P, p]
Alternate versions
Using JS built-ins, a more straightforward answer is 79 bytes:
(x,y,a)=>[a.indexOf(y,a.indexOf(x)),a.slice(0,a.lastIndexOf(y)).lastIndexOf(x)]
which can be slightly compressed to 75 bytes:
(x,y,a)=>[a.indexOf(y,a.indexOf(x)),a.slice(0,a[L='lastIndexOf'](y))[L](x)]
Try it online!
Edit: @Neil managed to reduce it to a very nice 67-byte:
(x,y,a,f=s=>a[z=y,y=x,x=z,s+=`ndexOf`](x,a[s](y)))=>[f`i`,f`lastI`]
Try it online!
APL (Dyalog Classic), 29 27 bytes
⊃{(⊃⍵~⍳⊃⍺),⊃⌽⍺∩⍳⊃⌽⍵}/⍸¨⎕=⊂⎕
Try it online!
prompts for the array and then for var1,var2
Python 2, 72 bytes
def f(x,y,a):i=a.index;j=a[::-1].index;print i(y,i(x)),len(a)+~j(x,j(y))
Try it online!