You can solve for this in three ways:
1.
Speed in stillwater + speed of current = downstream speed
=> 23 + x = 28
=> x = 5 miles per hour
2.
Speed in stillwater - speed of current = upstream speed
=> 23- x = 18
=> x = 5 miles per hour
3.
Even if you did not know the speed in stillwater (let's call it y), you can still solve for the speed of current (let's call it x):
upstream speed = speed in stillwater - speed of the current
=> 18 = y - x --- 1st equation
downstream speed = y + x
=> 28 = y + x --- 2nd equation
You have two equations and two variables, solve it by subtracting 2 from 1 to eliminate y:
28 - 18 = x - (-x)
=> 10 = 2x
=> x = 5 miles per hour